ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Reference Outlook in VBA (https://www.excelbanter.com/excel-programming/401529-reference-outlook-vba.html)

Noemi

Reference Outlook in VBA
 
Hi

I have an excel spreadsheet which is used on different versions ie 97 & 2000.

I need to be able to email the spreadsheet using a macro however at the
moment I get a compile error.

We are unable to set the library reference on the 97 version because to save
the form we must run it through 2000 first.

Any idea's what I need to do to set the correct reference using code.

Thanks

Bob Phillips

Reference Outlook in VBA
 
Take a look here http://www.xldynamic.com/source/xld.EarlyLate.html

--
---
HTH

Bob

__________________________________________
UK Cambridge XL Users Conference 29-30 Nov
http://www.exceluserconference.com/UKEUC.html

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Noemi" wrote in message
...
Hi

I have an excel spreadsheet which is used on different versions ie 97 &
2000.

I need to be able to email the spreadsheet using a macro however at the
moment I get a compile error.

We are unable to set the library reference on the 97 version because to
save
the form we must run it through 2000 first.

Any idea's what I need to do to set the correct reference using code.

Thanks




Noemi

Reference Outlook in VBA
 
Hi Bob
I am trying to use the sample code however the following line stays red and
I dont know why

Set objRecipient.Add("John Wilson")

any idea's as I cannot test it until this is not red anymore.

thanks

"Bob Phillips" wrote:

Take a look here http://www.xldynamic.com/source/xld.EarlyLate.html

--
---
HTH

Bob

__________________________________________
UK Cambridge XL Users Conference 29-30 Nov
http://www.exceluserconference.com/UKEUC.html

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Noemi" wrote in message
...
Hi

I have an excel spreadsheet which is used on different versions ie 97 &
2000.

I need to be able to email the spreadsheet using a macro however at the
moment I get a compile error.

We are unable to set the library reference on the 97 version because to
save
the form we must run it through 2000 first.

Any idea's what I need to do to set the correct reference using code.

Thanks





Bob Phillips

Reference Outlook in VBA
 
Can we see the rest of the code?

--
---
HTH

Bob

__________________________________________
UK Cambridge XL Users Conference 29-30 Nov
http://www.exceluserconference.com/UKEUC.html

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Noemi" wrote in message
...
Hi Bob
I am trying to use the sample code however the following line stays red
and
I dont know why

Set objRecipient.Add("John Wilson")

any idea's as I cannot test it until this is not red anymore.

thanks

"Bob Phillips" wrote:

Take a look here http://www.xldynamic.com/source/xld.EarlyLate.html

--
---
HTH

Bob

__________________________________________
UK Cambridge XL Users Conference 29-30 Nov
http://www.exceluserconference.com/UKEUC.html

(there's no email, no snail mail, but somewhere should be gmail in my
addy)



"Noemi" wrote in message
...
Hi

I have an excel spreadsheet which is used on different versions ie 97 &
2000.

I need to be able to email the spreadsheet using a macro however at the
moment I get a compile error.

We are unable to set the library reference on the 97 version because to
save
the form we must run it through 2000 first.

Any idea's what I need to do to set the correct reference using code.

Thanks







Noemi

Reference Outlook in VBA
 
Hi Bob

Below is the code I am using, I have marked the line which stays red and I
dont know why.

Dim objOutlook As Object
Dim objNameSpace As Object
Dim objMailItem As Object
Dim objRecipient As Object

Set objOutlook = CreateObject("Outlook.Application")
Set objNameSpace = objOutlook.GetNamespace("MAPI")

Set objMailItem = objOutlook.CreateItem(0)

Set objRecipient.Add("John Wilson") **********Stays Red
objRecipient.Type = 1

objMailItem.Subject = "Testing Only"
objMailItem.Body = "Testing only"
objMailItem.Attachments.Add ActiveWorkbook.FullName

objNameSpace.Logon , , True
objMailItem.Send

Set objRecipient = Nothing
Set objMailItem = Nothing
Set objNameSpace = Nothing
Set objOutlook = Nothing

Thanks
Noemi

"Bob Phillips" wrote:

Can we see the rest of the code?

--
---
HTH

Bob

__________________________________________
UK Cambridge XL Users Conference 29-30 Nov
http://www.exceluserconference.com/UKEUC.html

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Noemi" wrote in message
...
Hi Bob
I am trying to use the sample code however the following line stays red
and
I dont know why

Set objRecipient.Add("John Wilson")

any idea's as I cannot test it until this is not red anymore.

thanks

"Bob Phillips" wrote:

Take a look here http://www.xldynamic.com/source/xld.EarlyLate.html

--
---
HTH

Bob

__________________________________________
UK Cambridge XL Users Conference 29-30 Nov
http://www.exceluserconference.com/UKEUC.html

(there's no email, no snail mail, but somewhere should be gmail in my
addy)



"Noemi" wrote in message
...
Hi

I have an excel spreadsheet which is used on different versions ie 97 &
2000.

I need to be able to email the spreadsheet using a macro however at the
moment I get a compile error.

We are unable to set the library reference on the 97 version because to
save
the form we must run it through 2000 first.

Any idea's what I need to do to set the correct reference using code.

Thanks








All times are GMT +1. The time now is 08:25 AM.

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