Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / August 2007

Tip: Looking for answers? Try searching our database.

Update mailmerge path with vba on opening - Add-ins or another way?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
tskogstrom - 27 Aug 2007 11:01 GMT
Hi,

I have a mailmerge document connected to a excel named range. The link
reference is to a library below my 'office standard library'.

When I send the excel source file and the mailmerge word document to
other users, the link/connection doesn't work. I guess it still is
pointing to my own library path and not theirs.

How can I update the refererence path /mailmerge connection so it will
be correct for the user?

I have some code from excel i probably can use in word also (se below
if your are interested) to find the right path, but i'm not used with
VBA in word. Should I create a add-in that do this  on opening event
and when this filename is the right one? Or can you have som vba code
follow the word file? When I try to save VBA in the ThisDocument
module, it will get lost after reopening...

Kind regards
Tskogstrom

-----------------------------------
In a excel application i use this function in vba to identify standard
library(should be able to use it in word(?)):

Function stdDocumentPath()
'Let you know the standard document catalog of the user = myDocPath
'*************************************''

Dim myDocPath As String
On Error GoTo stdDocumentPath_Error
Let myDocPath = Application.DefaultFilePath

'Add a "\" at the end of the path, unless the setting is already
followed by a "\" -
'which it will be if the setting is set to a root folder
If Not Right$(myDocPath, 1) = "\" Then
   myDocPath = myDocPath + "\"
End If

Let stdDocumentPath = myDocPath
Debug.Print "stdDocumentPath: " & stdDocumentPath

On Error GoTo 0
Exit Function

stdDocumentPath_Error:
Debug.Print "Error " & Err.Number & " (" & Err.Description & ") in
procedure ""stdDocumentPath"" of Module UsedCode"
Debug.Print myDocPath
Debug.Print stdDocumentPath
Sheets("Show").Range("a1").Value = "Fel"
On Error GoTo 0
Exit Function

End Function

I call it with:
'Open source file, copy content and paste in this workbook
Workbooks.Open (orgStdPath & FolderName & "\" & SourceDoc)

... where FolderName is the name of the folder "Merge" and SourceDoc
is the name of the Excelfile that is the data source to the word
mailmerge document.
Peter Jamieson - 27 Aug 2007 17:13 GMT
Responded in the mailmerge.fields group.

Signature

Peter Jamieson
http://tips.pjmsn.me.uk

> Hi,
>
[quoted text clipped - 61 lines]
> is the name of the Excelfile that is the data source to the word
> mailmerge document.
tskogstrom - 28 Aug 2007 07:26 GMT
Thank you Peter. Please check that thread, I had a following question,
probably easy for you to answer to...

Thread:
http://groups.google.com/group/microsoft.public.word.mailmerge.fields/browse_thr
ead/thread/69a58de654c74917/22adec184ab96edc?hl=sv#22adec184ab96edc


Kind regards
Tskogstrom

------------------------------------------------

On 27 Aug, 18:13, "Peter Jamieson" <p...@KillmapSpjjnet.demon.co.uk>
wrote:
> Responded in the mailmerge.fields group.
>
[quoted text clipped - 68 lines]
>
> - Visa citerad text -
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.