I use word automation in my VB6 application.
I am doing a mailmerge:
I have my labelinfo in an acces table
The rst is the recordset to it.
All measure values are stored in millimeters not in inch or points.
So i have to convert to points because that's what word uses.
And i init all the mailinglabel vars.
VB Code:
With AppWord.MailingLabel.CustomLabels(Labelnaam) .NumberAcross = rst("Kolommen") .NumberDown = rst("Rijen") .SideMargin = ScaleX(rst("MargeLinks"), vbMillimeters, vbPoints) 'UEenheidsmaat .TopMargin = ScaleY(rst("MargeBoven"), vbMillimeters, vbPoints) .VerticalPitch = ScaleY(rst("VPitch"), vbMillimeters, vbPoints) .HorizontalPitch = ScaleX(rst("HPitch"), vbMillimeters, vbPoints) .Width = ScaleX(rst("Breedte"), vbMillimeters, vbPoints) .Height = ScaleY(rst("Hoogte"), vbMillimeters, vbPoints) End With
Appword.Activedocument.Mailmerge.execute
Now mostly this works but because of the millimeter to points conversion this sometimes gives problems with certain labelsizes. (table overlaps to a second page)
So i have example a 2 row 3 column labelpaper. Size W 105 x H 99 mm
So 3 x 99 = 297 which is the exact maxium labelheight !
But Word says this is an invalid labelsize. When i make the height and Vpitch 98 instead of 99 it works fine.
Probably due to the converstion from mm to points, this seems to give slightly over the max pageheight. How can i solve this best.
I can change labelheight 99 slightly (which normally should be correct)
Or i change page height from 297 to 298 to give 1 mm margin, but how do i do that so Word makes a DOc with 298 mm height when executing the mailmerge because i tried this altough i set my original doc to 298 it 's mailmerge result doc stays 297.


Reply With Quote