A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

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



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old August 15th 07, 08:12 PM posted to microsoft.public.outlook.program_vba
John Z
external usenet poster
 
Posts: 2
Default Please help on this VBA macro. Error 13, type mismatch

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.




  #2  
Old August 15th 07, 08:34 PM posted to microsoft.public.outlook.program_vba
Eric Legault [MVP - Outlook]
external usenet poster
 
Posts: 830
Default Please help on this VBA macro. Error 13, type mismatch

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.

--
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/


"John Z" wrote:

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.




  #3  
Old August 15th 07, 09:10 PM posted to microsoft.public.outlook.program_vba
John Z
external usenet poster
 
Posts: 2
Default Please help on this VBA macro. Error 13, type mismatch

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.

"Eric Legault [MVP - Outlook]" wrote:

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.

--
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/


"John Z" wrote:

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.




  #4  
Old August 15th 07, 09:36 PM posted to microsoft.public.outlook.program_vba
Eric Legault [MVP - Outlook]
external usenet poster
 
Posts: 830
Default Please help on this VBA macro. Error 13, type mismatch

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/


"John Z" wrote:

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.

"Eric Legault [MVP - Outlook]" wrote:

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.

--
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/


"John Z" wrote:

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.




 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Runtime Error 13 - Type Mismatch [email protected] Outlook and VBA 1 May 29th 07 11:28 PM
Strange behaviour with Type Error Tobias Schröer Outlook and VBA 0 January 31st 07 09:48 AM
Script Error - Type mismatch: 'Mycontrols' Line No. 415 sclark Outlook - Using Forms 2 April 13th 06 08:00 PM
Why do I get a type mismatch when trying to access mail items? Pete Dawson (Leeds Uni) Outlook and VBA 3 March 3rd 06 01:16 PM
expression which is not collaction type error in vb.net Sanjay Outlook and VBA 3 February 24th 06 02:48 PM


All times are GMT +1. The time now is 10:39 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.