Individual merge letters - add-in error

C

C. Cunningham

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
 
D

Doug Robbins - Word MVP

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?



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

C. Cunningham

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?
 
D

Doug Robbins - Word MVP

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.

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

C. Cunningham

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.
 
G

Graham Mayor

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.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
D

Doug Robbins - Word MVP

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.

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

Doug Robbins - Word MVP

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.

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

C. Cunningham

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.
 
C

C. Cunningham

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
 
C

C. Cunningham

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
 
G

Graham Mayor

By the time you see this, the update should be available from my web site.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
G

Graham Mayor

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 ;)

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
C

C. Cunningham

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?
 
D

Doug Robbins - Word MVP

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.

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

C. Cunningham

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!!
 
G

Graham Mayor

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.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
C

C. Cunningham

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
 
G

Graham Mayor

That's good news. Thanks for the feedback.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
C

C. Cunningham

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.
 

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