Programatically set Outlook reference

LEXCERM

Active Member
Joined
Jun 26, 2004
Messages
320
Office Version
  1. 365
Platform
  1. Windows
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

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
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?
 
Upvote 0
Thanks for the pointer Norie. I'll search late binding now.

Cheers,
Paul.
 
Upvote 0
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.
 
Upvote 0

Forum statistics

Threads
1,215,029
Messages
6,122,757
Members
449,094
Latest member
dsharae57

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
Back
Top