Using VBA for Excel97 to automate Outlook97 or Outlook98

Rudi GOUSSEY

New Member
Joined
Jan 8, 2004
Messages
32
I have a excelfile with a macro with reference to msoutl8.olb(office97) which is in a shared drive. This macro is being used by other depts. One dept uses outlook97, another uses outlook98, and another doesn't use outlook. When the first dept uses this macro, it creates an error for them because they have outllook98 and thus changes the reference to msoutl85.olb in their pcs. How can i solve this problem.

I tried this to insert this piece of code in the macro, but this doesn't solve the problem : VBA for Excel97 doesn't know the method References.AddFromFile
….
If Dir("C:\Program Files\Microsoft Office\Office\msoutl8.olb") Then
References.AddFromFile ("C:\Program Files\Microsoft Office\Office\msoutl8.olb")
Else
References.AddFromFile ("C:\Program Files\Microsoft Office\Office\msoutl85.olb")
End If
……
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Hi, welcome to the board.

Have a play around with this;

Code:
Sub file_exists()
'look in directory for filename

If Len(Dir("C:\Program Files\Microsoft Office\Office\msoutl9.olb", vbDirectory)) = 0 Then
References.AddFromFile ("C:\Program Files\Microsoft Office\Office\msoutl8.olb")
Else
References.AddFromFile ("C:\Program Files\Microsoft Office\Office\msoutl85.olb")
End If
End Sub
 
Upvote 0
Thanks for the reply

By running your code i got the same errormessage as my code and this on the code line (although msoutl8.olb is available on the given path) :

. . .
References.AddFromFile ("C:\Program Files\Microsoft Office\Office\msoutl8.olb")
. . .

Errormessage :
Runtime error 424
Object Required

It seems vba for excel97 doesn't know the method or object "References.AddFromFile" . . .
 
Upvote 0

Forum statistics

Threads
1,214,976
Messages
6,122,539
Members
449,088
Latest member
RandomExceller01

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