#1
|
|||
|
|||
How do I find the Source folder?
Hope someone can help.
I've taken over managing a system for someone - and it has a lot of Word Documents that have been created as merge templates - expecting a 'merge.txt' to be available containing the fields for the merge. What I dont know is where the merge.txt is supposed to live - ie which folder. Tried it in the same as the Word.dot documents but just get a 'Data Source Name not found..." error. How can I tell from a document where it is expecting its data source to be ? If I open the document and select the 'Open Data Source' icon then I can point to it and change it - but there are hundreds of these and i'd rather just find out where it expects things to be. Help appreciated. Phil |
#2
|
||||
|
||||
Hi Phil,
If you add the following macro to, say, Word's 'Normal' template, running it will tell you whether the active document is a mailmerge main document and, if so, where it thinks the data source should be. Code:
Sub FindmergeSource() With ActiveDocument.MailMerge If .MainDocumentType <> wdNotAMergeDocument Then MsgBox .DataSource.Name Else MsgBox "Not A Merge Document" End If End With End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
Thanks for the feedback Macropod.
I tried to add the function to the Word.dot file - but just get a msgbox with Blank. Not sure i'm putting the code in properly; I loaded the .dot document - it came up with the message to say that opening was going to run a command Select * etc etc ... If I say YES then says Data Source not found; if i say No it opens. 1st tried to just add it into a code module in the .dot file - then Run thru debug...Msgbox says Blank Then - added a button to the .dot document and put the code on it and selected Exit Design Mode - clicked the button - This time said that it wasn't a merge document. I've renamed one of the the .dots to a .doc and attached to this message... Your help is much appreciated Phil |
#4
|
||||
|
||||
Hi Phil,
You can't test the mailmerge datasource location until after the document has opened but, in doing so, you need to either locate it for yourself if Word can't, or allow Word to remove that info from the file. Thus, before you can run the macro, you've either solved the problem or destroyed the evidence ... What you can do when Word doesn't find the datasource is respond 'Yes' to the SQL prompt, then 'OK'. The next dialogue box tells you where the datasource was expected, including the filename. In the case of the document you posted, it's: C:\Program Files\TakingLife\merge.txt After noting the datasource details, you can simply cancel out of opening the document. Although the datasource details are stored in the Word document (in the metadata towards the end of the file), I've not been able to find any code for reading that from an otherwise closed document with vba.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
|||
|
|||
Thanks very much for that - it helps a lot.
Didnt give me that Path - just showed a message with DSNxjhxgh stuff in. I can now move on though...fancy not putting the merge file where the documents are - previous programmer did this !! Thanks Again phil |
#6
|
||||
|
||||
Putting the data source anywere under "C:\Program Files\" is very strange - they should go in a public data folder, a particular folder under the user's profile or, as you say, perhaps the same folder as the mailmerge main document.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#7
|
|||
|
|||
yes agreed - a few funnies in the system - hence the client asking me to take it on...
Thanks again |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Outlook 2010 View Source | tbragsdae | Outlook | 2 | 07-25-2012 06:33 PM |
tracking source when pasting between documents | kirko | Word | 0 | 08-22-2010 09:15 PM |
Can't find Task Folder | kc300c | Outlook | 0 | 08-02-2010 09:22 PM |
Issue with formula's from an outside source | phroche | Excel | 0 | 11-07-2008 03:08 PM |
Installation Source Corrupted | browneyes | Office | 1 | 01-23-2006 02:33 PM |