MS Office Forum / Word / Mailmerge and Fax / February 2006
Individual merge letters - add-in error
|
|
Thread rating:  |
C. Cunningham - 18 Jan 2006 01:57 GMT Hi there,
I'm trying to use the add-in that I downloaded from Graham's site (http://www.gmayor.com/individual_merge_letters.htm) and I keep getting a Microsoft Visual Basic error message that says: 'Compiler error in hidden module: Merge Application' after I select "All" in the "Merge to New Document" window.
I see that Pete had this same problem last week (1/9/06, merge to separate files), and Doug gave some helpful troubleshooting information, however I'm still getting the error message. I'm wondering if I have it installed correctly, or if it has something to do with the way my system is set up. I had one of our IT staff try setting it up as an adminstrator on my computer, and we still got the same result, so I don't think that is what the problem is.
System Info I'm using Word 2002 SP3, operating on Windows XP Pro, Version 5.1.2600 Service Pack 2 Build 2600. Does it matter that I don't use Outlook as my email program? I have Outlook Express 6 installed on the system, but my company uses GroupWise (Novell GroupWise 6.5) instead.
Settings Info In Word, under Tools>Templates and Add-ins, I have 3 files listed in the 'Global templates and add-ins' list: - MMtoDocsRev16.dot - PDFMaker.dot - PDFMakerA.dot Only the first two are checked as currently loaded items.
Under Tools>References in the Visual Basic Editor I only have the following items checked in the Available References list: - Visual Basic for Applications - Microsoft Word 10.0 Object Library - OLE Automation - Microsoft Office 10.0 Object Library - Microsoft Forms 2.0 Object Library
Is there any other system information that might be helpful?
Thanks, Cara
Doug Robbins - Word MVP - 18 Jan 2006 05:04 GMT On my system, using Word/Office 2003, its the Word 11.0 and Office 11.0 Object Libraries that are checked under References.
Outlook should not be coming into it. What is the data source for the mail merge?
 Signature Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis.
Doug Robbins - Word MVP
> Hi there, > [quoted text clipped - 45 lines] > Thanks, > Cara C. Cunningham - 18 Jan 2006 17:29 GMT The datasource is a worksheet in Excel 2002 SP3.
I looked for the Word 11.0 and Office 11.0 options, and they aren't on my list, so they must be used with the '03 version of Word.
I'm wondering, has anyone out there with Word 2002 been able to use the add-in template successfully, or do I have to have Word 2003 to be able to use it?
Doug Robbins - Word MVP - 18 Jan 2006 19:07 GMT Sorry, I guess I misread the SP3 as 2003. I think however that it should work in Word 2002.
Try unchecking the add-in Tools>Templates and Add-ins, then open the .dot file in Word and then open the visual basic editor select the project and open each of the modules, classes in it and with the selection in each one in turn, from the Debug menu in the visual basic editor, select Compile and if you get an error. let us know what line of code is highlighted.
 Signature Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis.
Doug Robbins - Word MVP
> The datasource is a worksheet in Excel 2002 SP3. > [quoted text clipped - 4 lines] > add-in template successfully, or do I have to have Word 2003 to be able to > use it? C. Cunningham - 18 Jan 2006 21:12 GMT Okay, you might need to bear with me, because although I'm an experienced Word user, and have created tons of complex merges with embedded IF statements, I've never actually gone into the VB editor before yesterday, so this is a new world for me, and I might not use the proper terminology.
I turned off the add-in, and opened the template, but the add-in was still turned on. I can't get the change to stick. I unchecked the add-in again and opened the VB editor. I went to View>Project Explorer and opened the "Modules" folder, under which I have two files "Module1" and "Printers". I also have a "Class Modules" folder which contains the file "Merge Application".
When I select any of the 3 files, and select Debug>Compile TemplateProject, I get an error message that reads:
Compile error: Can't find project or library
After clicking OK, it takes me to the References - TemplateProject Dialog box and the Microsoft Outlook 11.0 Object Library reference is preceded by "MISSING:".
According to the help files, I should browse my system to look for the missing reference, but I don't know where to look.
Graham Mayor - 19 Jan 2006 07:39 GMT Doug will no doubt be along later to correct me if I am wrong, but in this case the Microsoft Outlook 11.0 Object Library reference is for Office 2003. If you look up tools > references, you should find the Microsoft Outlook 10.0 Object Library. Check that one and save. If that doesn't fix it I think we need to wait and see what call Doug is using from that library. Let us know either way as my web site will need a note to reflect the changes required to fix this.
 Signature <>>< ><<> ><<> <>>< ><<> <>>< <>><<> Graham Mayor - Word MVP
My web site www.gmayor.com Word MVP web site http://word.mvps.org <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> Okay, you might need to bear with me, because although I'm an > experienced Word user, and have created tons of complex merges with [quoted text clipped - 21 lines] > According to the help files, I should browse my system to look for the > missing reference, but I don't know where to look. C. Cunningham - 19 Jan 2006 19:18 GMT Since I only have Outlook Express installed on my system, I don't have the Microsoft Outlook 10.0 Object Library either. My IT department has the disk that they can load Outlook onto my computer if we have to, but Doug said that he found the error and has a revised template that should work without Outlook, so I'll wait and try that first.
Thanks, Cara
Graham Mayor - 20 Jan 2006 07:38 GMT By the time you see this, the update should be available from my web site.
 Signature <>>< ><<> ><<> <>>< ><<> <>>< <>><<> Graham Mayor - Word MVP
My web site www.gmayor.com Word MVP web site http://word.mvps.org <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> Since I only have Outlook Express installed on my system, I don't > have the Microsoft Outlook 10.0 Object Library either. My IT [quoted text clipped - 5 lines] > Thanks, > Cara Doug Robbins - Word MVP - 19 Jan 2006 13:48 GMT While for other purposes on my machine, I do have a reference to the Microsoft Outlook 11.0 Object Library, there is nothing in that Mail Merge to Docs add-in that is using anything from that library. Try unchecking the add-in from the Tools>Templates and Add-in menu item again, then open the Visual Basic Editor, and select that project and then somewhere in one of the modules, press the Enter Key (just so that the system thinks that it has been changed) and then on the toolbar in the Visual Basic Editor, click on the Save button.
Then, shut down Word completely, then re-start it and see if it works.
Please do let us know how you get on.
 Signature Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis.
Doug Robbins - Word MVP
> Okay, you might need to bear with me, because although I'm an experienced > Word user, and have created tons of complex merges with embedded IF [quoted text clipped - 23 lines] > According to the help files, I should browse my system to look for the > missing reference, but I don't know where to look. C. Cunningham - 19 Jan 2006 19:15 GMT It worked at first. I went in and made the changes you suggested and saved the file and closed Word. I opened up my merge and it let me through to the "Merge to Document" dialog box, and then the "Select Filename Field" dialog box. I selected the last name field, browsed and found my file path and clicked Continue. I then receive the following VB error message:
Run-time error '-2147467259 (80004005)': Method "PrivateProfileString' of object 'System' failed
The error dialog box has four option buttons, Continue, End, Debug, and Help. Continue and Debug are both grayed out and not available, End and Help are the only options available. The help screen it brings up is only gray, no info. When I click end, it just completes the normal merge, all in one document.
I'll wait for you to email me the revised add-in, or I'll check back on Graham's site later to see if it has been uploaded. I'll let you know how the new version works.
Doug Robbins - Word MVP - 19 Jan 2006 15:13 GMT Cara,
I think that I have tracked down the problem, so if what I suggested in my earlier post does not work, if you can send me your email address, I will send a revised add-in. Alternatively, I have sent the revision to Graham so he should add it to his website fairly soon.
 Signature Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis.
Doug Robbins - Word MVP
> Okay, you might need to bear with me, because although I'm an experienced > Word user, and have created tons of complex merges with embedded IF [quoted text clipped - 23 lines] > According to the help files, I should browse my system to look for the > missing reference, but I don't know where to look. C. Cunningham - 20 Jan 2006 01:57 GMT Hi Doug,
I tried the revised template and it worked at first. I ran my merge and it again let me through to the "Merge to Document" dialog box, and then the "Select Filename Field" dialog box. I selected the last name field, entered my file path and clicked Continue. I then receive the following VB error message:
Run-time error '-2147467259 (80004005)': Method "PrivateProfileString' of object 'System' failed
We may have figured out part of it. My IT dept. has been helping me on this too, and he installed Outlook and all current Office updates on my computer. Still, I got the same error message, so I don't think that had anything to do with it. Then, he had the idea to give me higher access rights to my computer, and, lo and behold, it works just fine, separate files nice and neat.
I was originally at the "User" level, but we tested it at both the "Adminstrator" level and the "Power User" level and it works fine.
Question: Do you know if full rights HAVE to be turned on for this to work, or is there just a setting that we can change to allow it to work with my normal "user" rights?
Thanks, Cara
Graham Mayor - 20 Jan 2006 11:04 GMT It appears that the macro falls because you do not have write permission to the root of C: and thus cannot create settings.txt there. If you edit the mergeapplication module to change all occurrences of c:\settings.txt to use a path that you do have write access to (eg your documents folder) then it should work ..... I think ;)
 Signature <>>< ><<> ><<> <>>< ><<> <>>< <>><<> Graham Mayor - Word MVP
My web site www.gmayor.com Word MVP web site http://word.mvps.org <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> Hi Doug, > [quoted text clipped - 23 lines] > Thanks, > Cara C. Cunningham - 20 Jan 2006 18:35 GMT That's it! I tested it and it works great! I replaced all occurences of C:\settings.txt with C:\Documents and Settings\ccunningham\My Documents\My Documents, and it worked just fine, and I tested it on my co-worker's computer and it also works.
Thank you both Doug and Graham so much for all of your help on this issue!
I have just one final question. When I open the newly created individual merge files, they open in the "Normal" screen view, instead of "Print Layout" view. Is there a code I can put somewhere that will save the file in print layout view instead?
Doug Robbins - Word MVP - 20 Jan 2006 20:51 GMT To do that, you will need to make the following changes to the:
Private Sub app_MailMergeAfterMerge(ByVal Doc As Document, ByVal DocResult As Document)
Change the line
Set NewDoc = Documents.Add(Visible:=False)
to
Set NewDoc = Documents.Add(Visible:=True)
and add the following line:
ActiveWindow.View.Type = wdPrintView
before the line:
NewDoc.SaveAs FldrPath & fnames(i)
Note however that you will get a lot more screen activity during the process.
 Signature Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis.
Doug Robbins - Word MVP
> That's it! I tested it and it works great! I replaced all occurences of > C:\settings.txt with C:\Documents and Settings\ccunningham\My Documents\My [quoted text clipped - 9 lines] > print > layout view instead? C. Cunningham - 20 Jan 2006 22:24 GMT Wow, you guys really are an amazing resource. The code works perfectly. Thanks again to both you and Graham for all of your wonderful knowledge and support!!
Graham Mayor - 21 Jan 2006 07:49 GMT There's an updated version of the add-in now available for download from my web site which takes in these changes. Doug may have sent you a copy directly. Please try the updated version and let us know if it works for you.
 Signature <>>< ><<> ><<> <>>< ><<> <>>< <>><<> Graham Mayor - Word MVP
My web site www.gmayor.com Word MVP web site http://word.mvps.org <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> Wow, you guys really are an amazing resource. The code works > perfectly. Thanks again to both you and Graham for all of your > wonderful knowledge and support!! C. Cunningham - 23 Jan 2006 17:41 GMT Hi Graham,
Yes, Doug sent me the new version that is now on your website and it works great! I've shared it with a few co-workers, and it's much easier with the new template, because I had planned on updating the code to each person's "My Documents" path, but now I don't have to because the template works "out-of-the-box."
Thanks again! Cara
Graham Mayor - 24 Jan 2006 06:59 GMT That's good news. Thanks for the feedback.
 Signature <>>< ><<> ><<> <>>< ><<> <>>< <>><<> Graham Mayor - Word MVP
My web site www.gmayor.com Word MVP web site http://word.mvps.org <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> Hi Graham, > [quoted text clipped - 6 lines] > Thanks again! > Cara C. Cunningham - 10 Feb 2006 01:55 GMT I don't know if either of you (Doug or Graham) monitors old posts, but I'm having another issue with this now that I'm using it. I've posted a new message to the board.
Graham Mayor - 10 Feb 2006 07:29 GMT We both do ;)
 Signature <>>< ><<> ><<> <>>< ><<> <>>< <>><<> Graham Mayor - Word MVP
My web site www.gmayor.com Word MVP web site http://word.mvps.org <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> I don't know if either of you (Doug or Graham) monitors old posts, > but I'm having another issue with this now that I'm using it. I've > posted a new message to the board. Doug Robbins - Word MVP - 10 Feb 2006 18:46 GMT Not exactly. I check for unread ones.
 Signature Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis.
Doug Robbins - Word MVP
> We both do ;) > >> I don't know if either of you (Doug or Graham) monitors old posts, >> but I'm having another issue with this now that I'm using it. I've >> posted a new message to the board.
|
|
|