Programatically set Outlook reference

LEXCERM

Active Member
Joined
Jun 26, 2004
Messages
309
Hi there,

I have an Excel file which I use both at home and at work. I have 2003 installed at home and 2007 at work.

I keep running into the same problem whereby I have to keep changing the Outlook Object reference each time I want to use a macro depending where I am (the reference has MISSING next to it).

I'm sure there is a way where I can programatically set the reference whenever I start the macro, but I can't remember what it is. Something to do with navigating through the menus, like:-

Code:
On  Error Resume Next
Application.????????.("Microsoft Outlook 11.0 Object Library")
Application.????????.("Microsoft Outlook 12.0 Object Library")
On Error GoTo 0

Thanks in advance,
Paul.
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,357
Office Version
  1. 365
Platform
  1. Windows
I think there is a way to set the reference programatically.

But why not avoid the need for the reference in the first place by using late binding?
 

LEXCERM

Active Member
Joined
Jun 26, 2004
Messages
309
Thanks for the pointer Norie. I'll search late binding now.

Cheers,
Paul.
 

LEXCERM

Active Member
Joined
Jun 26, 2004
Messages
309
BTW, that late binding works perfectly. Thanks for the tip.

One final point which you may be able to help me with please. When I am attaching a file to the e-mail, I am saving the file as follows:-

ActiveWorkbook.SaveAs name_of_file.

I want to now be specific and save it in 2003 file format, i.e. .SaveAs name_of_file, FileFormat:=xlExcel7, but when the code runs it seems to crash the program.

What would be the file format for 2003?

Cheers,
Paul.
 

Forum statistics

Threads
1,181,723
Messages
5,931,679
Members
436,798
Latest member
spprtpplcm

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top