PDA

View Full Version : Excel to Word Label Mail Merge



mikeyjm30
09-14-2005, 03:59 AM
Hi everyone, I am a newbie to Excel VBA programming and am in need of some help.

I have a column in Excel which I have named 'Label' and runs from A1:A66. I would like to be able to mail merge this into Word labels and for the contents to be inserted via a mail merge. I know you can do this easily through mail merge but I want the code to do this from within Excel, as the labels can change from XXX001, XXX002 to AAA001, AAA002 etc.

I can get the Excel code to create my list and open word but can not get word to perform a mail merge. I have tried recording a macro and editing that but it didn't work.

Your help and thoughts would be greatly appreciated,

TIA

Mikey

sheeeng
09-14-2005, 07:21 AM
Welcome to VBAX, Mike! (if I did't guess wrongly)...

Mail merge in Excel only...A new thought for me...

mikeyjm30
09-14-2005, 07:44 AM
Thanks sheeeng.

What I would like to Excel to do is:-

1. I select the Office and the number and once I hit my print button from my Userform it creates my list of labels in cells A1:A66.

2. Excel will then open Word and connect to my spreadsheet and mail merge the info in the correct location. Then print it.

I am using Avery labels L7651. I have it working up to point 2 and from there I am lost.

Thanks

Mikey

mikeyjm30
10-04-2005, 07:56 AM
Can anyone help on this problem please?

Thanks

Mikey

mdmackillop
10-04-2005, 01:17 PM
Hi Mikey,
Have a look at the attached. The button in Excel creates a rangename "MyData" for the selected column and then opens the MailMerge document. There is a DocumentOpen macro which merges the records to a new document and then closes the mailmerge file. This is unfortunately closing Excel also, I'm not sure yet of a way around this.
Regards
MD

dave_gordon
01-27-2006, 04:20 AM
I would be gratful if anyone can tell me whether this routine can be change to merge only selected Excel Rows (Using the control key)?

AJO
02-10-2006, 09:35 AM
MD,

Thanks so much, this is wonderful. But I do have one problem. This works fine when the files are saved and run from my hard drive, but when I move them to our shared drive here, the macro doesn't recognize the word file. Does it have something to do with the fact that it's a shared drive? Does anyone know if there is a way around this?

Thanks so much,
AJO



Hi Mikey,
Have a look at the attached. The button in Excel creates a rangename "MyData" for the selected column and then opens the MailMerge document. There is a DocumentOpen macro which merges the records to a new document and then closes the mailmerge file. This is unfortunately closing Excel also, I'm not sure yet of a way around this.
Regards
MD