>Hi All,
>
>I'd like to reset the top and bottom margin of the new .doc to 0.5.
>
>This code does not crash but, it also does not change the margins. I've tried moving the code but this doesn't help.
>
>When the .doc loads in "Word", the text is still "selected", do you think this has something to do wioth the margins not be reset?
>
>Any help woould be appreciated, as always.
>
>Thanks,
>
>Jim Harvey
>jharvey@netrax.net
>
>
>***Here's the code
>store ThisForm.Sttxtcons.value to mcon
>repo form strpconsignorstatement for stncwork.cons_no = ThisForm.Sttxtcons.value ;
>to file &mcon ascii
>OWORD = createobject("Word.application")
>OWORD.visible = .T.
>mcurdir = curdir()
>myDocument = mcurdir + "\" + "&MCON" + ".DOC"
>oword.documents.open(mydocument)
>OWORD.activedocument.pagesetup.TopMargin = 0.5
>OWORD.activedocument.pagesetup.BottomMargin = 0.5
>OWORD.Selection.WholeStory
>OWORD.selection.Font.Name = "Courier New"
>OWORD.selection.Font.Size = 10
>ThisForm.Sttxtcons.value = " "
>ThisForm.Sttxtcons.SETFOCUS()
>thisform.refresh
James,
Margin setup is by points. Make it :
lnMargin = oword.CentimetersToPoints(0.5)
OWORD.activedocument.pagesetup.TopMargin = lnMargin
OWORD.activedocument.pagesetup.BottomMargin = lnMargin
PS: Also there is InchesToPoints if that's inch.
Cetin