Reply
 
Thread Tools Display Modes
  #1   Report Post  
Al Cameron
 
Posts: n/a
Default Mail merge does not work when files are moved to another machine

I have several (@40) Word files (Office 2003) that point to the same Excel
Files (Office 2003). Everything works fine on the development machine but
when I moved all the files to another machine (same path to the Excel file)
the merge does not work, making the merge file not portable.
  #2   Report Post  
Charles Kenyon
 
Posts: n/a
Default Mail merge does not work when files are moved to another machine

I suspect that this has to do with UNC coding of network addresses, which
may be different from what you would expect.

I set up a button in my merges toolbar to link to my database that is
machine independent. It is based on the merge file being in a particular
location relative to the Workgroup Templates folder. I make my merge
templates into non-merge documents (full of merge fields) and click on my
button to turn them into merge documents and link them to my database.

Function WorkGroupPath() As String
' Written by Charles Kenyon
' February 28, 2003
'
' Used by templates menus to set location of templates.
' Returns workgroup tempates path with "\" at the end.
'
' This is needed because if the folder is a network drive rather
' than a folder, it will have the "\" already. If it is a folder,
' it will not have the backslash. This function gives a string
' with the backslash in either case.
'
WorkGroupPath =
Application.Options.DefaultFilePath(wdWorkgroupTem platesPath)
If Right(WorkGroupPath, 1) "\" Then
WorkGroupPath = WorkGroupPath & "\"
End If
End Function

Sub AttachClients()
' Written by Charles Kenyon
' 19 April 2005
'
' Requires WorkGroupPath function
'
' Makes activedocument a mailmerge (letter) document and
' attaches Clients_Merge.xls from Parts folder of Workgroup Templates
folder.
'
' Then displays search dialog and goes to client, makes sure merge info is
' displayed instead of merge codes.
'
On Error Resume Next
'
' Name of file
Dim strFileName As String
Dim strProvider As String
strFileName = WorkGroupPath & "Parts\Merge Data\Clients_Merge.xls"
'
' Attach Merge list
' ActiveDocument.MailMerge.OpenDataSource _
Name:=strFileName, _
ConfirmConversions:=False, ReadOnly:=False, LinkToSource:=True, _
AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate:="",
_
WritePasswordDocument:="", WritePasswordTemplate:="", Revert:=False,
_
Format:=wdOpenFormatAuto, Connection:= _
"Provider=Microsoft.Jet.OLEDB.4.0;Password="""";Us er ID=Admin;Data
Source=C:\Documents and Settings\All Users\Documents\MS Office User System
Files\Shared Templates\Parts\Merge Data\Clients_Merge.xls;Mode=Read;Extended
Properties=""HDR=YES;IMEX=1;"";Jet OLEDB:" _
, SQLStatement:="SELECT * FROM `Clients$`", SQLStatement1:="",
SubType:= _
wdMergeSubTypeAccess
' ActiveDocument.MailMerge.OpenDataSource _
Name:=strFileName, _
ConfirmConversions:=False, ReadOnly:=False, LinkToSource:=True, _
AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate:="",
_
WritePasswordDocument:="", WritePasswordTemplate:="", Revert:=False,
_
Format:=wdOpenFormatAuto, _
Connection:= _
"Provider=Microsoft.Jet.OLEDB.4.0;Password="""";Us er ID=Admin;Data
Source=strFileName;Mode=Read;Extended Properties=""HDR=YES;IMEX=1;"";Jet
OLEDB:" _
, SQLStatement:="SELECT * FROM `Clients$`", SQLStatement1:="",
SubType:= _
wdMergeSubTypeAccess
' Following should be shorter version of above (somewhat)
ActiveDocument.MailMerge.OpenDataSource strFileName, , , False, _
True, False, "", "", False, "", "",
"Provider=Microsoft.Jet.OLEDB.4.0;Password="""";Us er ID=Admin;Data
Source=strFileName;Mode=Read;Extended Properties=""HDR=YES;IMEX=1;"";Jet
OLEDB:" _
, "SELECT * FROM `Clients$`", "", , wdMergeSubTypeAccess
'
' Show merge data
ActiveDocument.MailMerge.ViewMailMergeFieldCodes = False
'
' Find client
Application.Dialogs(wdDialogMailMergeFindRecipient ).Show
End Sub


--
Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide

See also the MVP FAQ: http://word.mvps.org/FAQs/ which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.

"Al Cameron" Al wrote in message
...
I have several (@40) Word files (Office 2003) that point to the same Excel
Files (Office 2003). Everything works fine on the development machine but
when I moved all the files to another machine (same path to the Excel
file)
the merge does not work, making the merge file not portable.



Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Saving mail merge documents to different files Brownsugar Mailmerge 3 November 11th 05 02:08 PM
Attaching different Excel files to emailed mail merge using merge. Pete Cuff Mailmerge 1 November 3rd 05 06:54 PM
Mail Merge Losing Data Scott May Mailmerge 1 November 1st 05 11:03 PM
Moved files to new computer and macros don't work Tserch Microsoft Word Help 2 December 29th 04 10:29 PM
Mail merge toolbar unavailable after SP3 R Scott Lowden Mailmerge 1 December 1st 04 06:24 PM


All times are GMT +1. The time now is 01:13 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"