PDA

View Full Version : [SOLVED] Setup page from excel to word



white_flag
12-19-2011, 06:39 AM
Hello

I try to setup an page from excel to word but I received the following error:

"object doesn't support this property or method"

search on net and seams that .CentimetersToPoints need to be WordDoc.CentimetersToPoints



With WordDoc.PageSetup
.TopMargin = WordDoc.CentimetersToPoints(4.5)
.BottomMargin = WordDoc.CentimetersToPoints(3.7)
.LeftMargin = WordDoc.CentimetersToPoints(2.5)
.RightMargin = WordDoc.CentimetersToPoints(1#)
.Gutter = WordDoc.CentimetersToPoints(0)
.HeaderDistance = WordDoc.CentimetersToPoints(1.25)
.FooterDistance = WordDoc.CentimetersToPoints(0.39)
.PageWidth = WordDoc.CentimetersToPoints(21)
.PageHeight = WordDoc.CentimetersToPoints(29.7)
End With


I putted like this (WordDoc.CentimetersToPoints) but the same error. the rest of the code is going. only this part is not ok. what it is wrong?

GTO
12-19-2011, 07:15 AM
With WordDoc.PageSetup
.TopMargin = WordDoc.Application.CentimetersToPoints(4.5)
.BottomMargin = WordDoc.Application.CentimetersToPoints(3.7)
.LeftMargin = WordDoc.Application.CentimetersToPoints(2.5)
.RightMargin = WordDoc.Application.CentimetersToPoints(1#)
.Gutter = WordDoc.Application.CentimetersToPoints(0)
.HeaderDistance = WordDoc.Application.CentimetersToPoints(1.25)
.FooterDistance = WordDoc.Application.CentimetersToPoints(0.39)
.PageWidth = WordDoc.Application.CentimetersToPoints(21)
.PageHeight = WordDoc.Application.CentimetersToPoints(29.7)
End With


Just a suggestion, but when it is part of the code that is referring to an operation in Word, you may wish to post the code and question in that forum. TinBender and a number of others can no doubt be of better help.

Mark

white_flag
12-19-2011, 07:27 AM
The code is in excel for word.. so if it is starting from excel, it is for excel :p (I will keep in my mind for the future post).

Mark, thanks (it is working)