Object Libraries and Macro Campatibility

P

PMC1

Hi,

I have an excel speadsheet that conatains a macro which performs some
automation tasks. The Macro was originally written with Office XP on a
Windows XP System. The idea is something like the following:

1. Original template file opened (Read only) by party X who enters
some info into a form
2. When the command button in Excel is clicked a copy of the workbook
is saved and attached to an email which is sent to Party Y
3. Party Y who is using Office 2003 opens the sheet attached to the
email, makes some further changes to the form, then clicks the button
again. This saves a new copy and attaches the new copy to an email
which is passed back to Party X.

The problem is that the orignal workbook has "References" to various
Microsoft Office 10 Object Libraries (Excel and Outlook). When this
copy is opened using Office 2003 these references are updated to point
to Microsoft Office 11 Object Libraries and the Macro runs fine but
when this is saved and passed back to Party X as in stage 3 mentioned
above the object Libraries (specifically the Outlook Object Libraries)
don't revert back to Microsoft Office 10 Libraries as hoped.

So in short how can I get a macro saved in Office 2003 to work in
Office XP?

Any help on this would be appreciated.

Paul
 
P

Perry

One way:
Remove the Object library references in VBE from your XP workbook and use
late binding in your code

For instance:
Replace
Dim olApp As Outlook.Application by
Dim olApp As Object

Note: do so for every object/childobject
You will also have to use the Long values instead of the enumerated constant
belonging to
(in this case) the Outlook object modell!
Test your project in Excel XP and not Excel 2003

--
Krgrds,
Perry

System:
Vista/Office Ultimate
VS2005/VSTO2005 SE
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top