ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Error in code opening Outlook (https://www.excelbanter.com/excel-programming/303996-error-code-opening-outlook.html)

muziq2[_17_]

Error in code opening Outlook
 
Hi,

I'm getting an error on another line that is supposed to open Outloo
and save add an appointment to the users calendar. The code is below.

The Private Sub cmdSave_Click() is highlighted as well as the Di
objApp as Outlook.Application.

Thanks in advance for your help.

Jeff

Private Sub cmdSave_Click()

Dim wb As Workbook

Dim objApp As Outlook.Application
Dim objNS As Outlook.NameSpace
Dim objAppointment As Outlook.AppointmentItem
Dim s As String, st As String, str As String, stri As String, strin A
String

On Error Resume Next
Set objApp = GetObject(, "Outlook.Application")
If Err.Number Then Set objApp = CreateObject("Outlook.Application")
On Error GoTo

--
Message posted from http://www.ExcelForum.com


Dick Kusleika[_2_]

Error in code opening Outlook
 
Jeff,

It sounds like you need to set a reference to the Outlook object libarary
(VBE - Tools - References), but you don't say which error you get. See also
http://www.dicks-clicks.com/excel/olBinding.htm

--
Dick Kusleika
MVP - Excel
Excel Blog - Daily Dose of Excel
www.dicks-blog.com


Hi,

I'm getting an error on another line that is supposed to open Outlook
and save add an appointment to the users calendar. The code is below.

The Private Sub cmdSave_Click() is highlighted as well as the Dim
objApp as Outlook.Application.

Thanks in advance for your help.

Jeff

Private Sub cmdSave_Click()

Dim wb As Workbook

Dim objApp As Outlook.Application
Dim objNS As Outlook.NameSpace
Dim objAppointment As Outlook.AppointmentItem
Dim s As String, st As String, str As String, stri As String, strin As
String

On Error Resume Next
Set objApp = GetObject(, "Outlook.Application")
If Err.Number Then Set objApp = CreateObject("Outlook.Application")
On Error GoTo 0


---
Message posted from http://www.ExcelForum.com/




muziq2[_18_]

Error in code opening Outlook
 
Thanks. That is the error that I'm getting because the reference isn'
set in Excel '97. Excel 2000 users were not having the problem. I'l
try to change the code based on the link you provided.

Thanks again.

Jef

--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 01:21 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com