Please help on this VBA macro. Error 13, type mismatch

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

HI, Everyone,

I am very new to VBA. Recently I upgraded Office 2003 to Office 2007 for the
staffs in our company. But some of the macros can not work since then. A
person who helf our company long time ago prepared these vba codes. That's
purpose for this macro is to let our admin staff to create evelope and label
efficiently. In Outlook 2003, select one contact from Public folders, then
one of these macro to create a lable/evenlope automatically. It worked fine
in Outlook 2003 but always gives me this "type mismatch" error. I run the
debug. It seems it always have problem when the program reaches
Set AddressTable = currentDoc.Tables(1)
Set rgeAddress = AddressTable.Cell(1, 1).Range

After the program execute "Set AddressTable = CurrentDoc.Tables(1)", it goes
to error message. rgeAddress and AddressTable are define as in the beginning
of the sub. "Dim rgeAddress As Range" and "Dim AddressTable As Table".

Please help. Thank you very much in advance.
 
I'm guessing some Office references didn't stick during the upgrade. Open
Outlook's VBA Editor, and choose References from the Tools menu. If you
don't see "Microsoft Word 12.0 Object library" listed near the top (and
checked), browse the list until you find it and check the box. Click OK,
then choose "Compile VbaProject" from the Debug menu (or a similarly named
project - it will be the first menu item). If there are no more missing
references (and no errors in the code), everything is fine. Otherwise a
dialog will tell you the issue. Fix it if you can and repeat until the
project compiles successfully. You'll have to do this on each PC that may
have the same macros deployed in Outlook.
 
Thank you for your quick response.

Actually "Microsoft Word 12.0 Object library" was checked even before I test
the Macros. I try to compile it as you suggested, but the Compile project1 is
grey out and not clickable. Any idea? Thank you.
 
If that menu option is greyed out that's okay - it means it has already been
compiled and there are no errors.

I can now say that this is most likely an issue with the Word code, which
just happens to be running in Outlook. There could very well be differences
between Word 2003 and Word 2007 that the author didn't account for. I'd post
the full the source code in microsoft.public.word.vba.general or a similar
group, and query about possible version differences between the Object Models.

--
Eric Legault - Outlook MVP, MCDBA, MCTS (SharePoint programming, etc.)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/
 
Back
Top