Word mailing labels - CreateNewDocument creates labels with wrong page size and margins

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Hello,

I am trying to automate Word (needs to be downward compatible to Word 2000, so I'm using msword9.olb library) to do a mail merge to mailing labels.

I'm using VC++, but I've also tried this with VB, and the same problem occurs.
I have directly put in the code found in article 258512, and the same problem occurs... so this should be easy to reproduce.

The problem is this:

When I create the mailing labels using automation, it creates a gigantic page of 11.22" x 12.05" size. The margins are all wrong, too.
I am trying to create a standard Avery 5160 label, and I pass in the code:

oNewDoc = oMLabel.CreateNewDocument( COleVariant( "5160"), vtOptional, vtOptional, vtOptional, vtOptional);

And what I get in the end is a large page full of labels 4 across and 12 down. I tried to change the page size directly, but the labels is still 4 across and 12 down, which means it's not really Avery 5160.

I tried the equivalent in VB using Word 2007 type library, and I got the same result.

My data source is a comma-delimited text file, but that shouldn't matter... the merging is fine. It's just that the page size and the margins are all wrong.

If you have any idea what is going on, and what I can do to fix it, I would appreciate it very much.

Thank you.

--Daniel

.



Relevant Pages

  • Re: Word mailing labels - CreateNewDocument creates labels with wrong page size and margins
    ... I'm guessing the problem is that the number of labels (and companies providing ... When I create the mailing labels using automation, ... The margins are all wrong, ... I am trying to create a standard Avery 5160 label, and I pass in the code: ...
    (microsoft.public.office.developer.automation)
  • Re: How do I save mailing labels resulting from a mail merge?
    ... I have been using Word to generate the mailing labels. ... > MVP FAQ site: http://mvps.org/ ... With Office 2003, Office creates a query, ...
    (microsoft.public.office.misc)
  • Re: Merging Mailing Labels from Outlook 2003 Contacts
    ... After you select Mailing Labels from the Document type pulldown in the ... Outlook "Mail Merge Contacts" dialog and click on the OK button, ... On that toolbar, you have to click on the 6th button from the ...
    (microsoft.public.word.mailmerge.fields)
  • Re: merging text columns
    ... Open Word,>blank document,>under tools select> mail merge ... Create> mailing labels> new document ... Get data> Data source> open appropriate file ...
    (microsoft.public.excel.misc)
  • Re: Changing Default Cell Alignment in Word 2007
    ... style for the mailing labels is table grid. ... But that didn't change the vertical alignment of the label. ... all kinds of tables, but not mailing labels. ... However, I was trying it yesterday, and did edit it in the Normal template. ...
    (microsoft.public.word.tables)