|
-
Oct 5th, 2010, 03:43 PM
#1
Thread Starter
Lively Member
[Word 2003 & Excel 2003] Mailmerge multiple sources
I have been tasked with creating a macro that would give the user a list of excel file data sources to chose from for a mailmerge.
The object is to minimize the number of front end steps that appear when the document is opened as the end users are not that Word and Excel savy.
My problem is that I can not figure out how to code the macro that I will be putting in the document.
I know that the form I will be creating will be fairly simple with a drop-down list offering the file choices for the merge, I'm just not sure how to prevent the following two steps that I am concatenating in the form from appearing to the end users.

Suggestions with be happily attempted.
Updated spec:
I also have to have it set to looking for the files in the directory that the Word doc is in, as it can't be totally guaranteed the directory will be in My Documents (for example).
datapard
Last edited by datapard; Oct 5th, 2010 at 04:27 PM.
Reason: Additional info received.
If you have to do it more than once...
Automate it!
-
Oct 6th, 2010, 04:41 AM
#2
Re: [Word 2003 & Excel 2003] Mailmerge multiple sources
are you writing in word, excel or other?
thisdocument.path will return the path, if the code is in that document
take out all the steps for crating a mailmerge document and provide your own interface, then provide the data source by code only
you can use shbrowseforfolder to select a folder, or fileopen dialog to select the data file, based on your own criteria
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Oct 6th, 2010, 11:42 AM
#3
Thread Starter
Lively Member
Re: [Word 2003 & Excel 2003] Mailmerge multiple sources
 Originally Posted by westconn1
are you writing in word, excel or other?
thisdocument.path will return the path, if the code is in that document
take out all the steps for crating a mailmerge document and provide your own interface, then provide the data source by code only
you can use shbrowseforfolder to select a folder, or fileopen dialog to select the data file, based on your own criteria
I'm working with an existant Word mailmerge document. I'm not sure how to remove the steps for creating a mailmerge, any suggestions on what I would need to do?
Thanks,
datapard
If you have to do it more than once...
Automate it!
-
Oct 6th, 2010, 03:27 PM
#4
Re: [Word 2003 & Excel 2003] Mailmerge multiple sources
if the word document is saved as a mailmerge document with an existing datasource, you will not get the wizard, then you can change the data source by code to suit
of course all available data sources, for selection, should have the same fields, otherwise would require editing of field names in document
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Oct 7th, 2010, 03:21 AM
#5
Thread Starter
Lively Member
Re: [Word 2003 & Excel 2003] Mailmerge multiple sources
 Originally Posted by westconn1
if the word document is saved as a mailmerge document with an existing datasource, you will not get the wizard, then you can change the data source by code to suit
of course all available data sources, for selection, should have the same fields, otherwise would require editing of field names in document
Oddly enough the document is saved as a mailmerge document. The existing datasource is, on my machine at least, sitting in the same directory. The two images above appear when the document is opened, so apparently I am doing something wrong. I'm not sure what.
I'm trying to figure out the code to change the data source using a form that appears when the document is opened (instead of the two above).
One thing I definitely intend to do is have them put all data source files together in their own directory which will, of course, make populating the choice form easier. And yes, they will be told that changing the fields in the source files will break the mailmerge.
Suggestions?
As always, thank your for your help.
datapard
If you have to do it more than once...
Automate it!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|