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

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.

jimboy

Well-known Member
Joined
Apr 11, 2002
Messages
2,314
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
 

Rudi GOUSSEY

New Member
Joined
Jan 8, 2004
Messages
32
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" . . .
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,152,322
Messages
5,769,453
Members
425,548
Latest member
macjagger17

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