General information
Category:
ActiveX controls in VFP
Title:
VBA for Excel in VFP Program
I have used extensively code within VFP to control changes in an Excel spreadsheet. To do this, I issue a
ExcelObj=CreateObject('Excel.Application')
WksHandle=ExcelObj.Workbooks.Open("c:\fax\callxls2.xls")
and then work with the appropriate VBA commands to do what I want. I now need to change the top and
bottom print margins on this spreadsheet. Recording an Excel macro and doing a File/Print Preview
manually shows the following code:
With ActiveSheet.PageSetup
.TopMargin = Application.InchesToPoints(0.5)
.BottomMargin = Application.InchesToPoints(0.5)
End With
(or alternatively....):
ExcelObj.ActiveSheet.PageSetup.TopMargin=Application.InchesToPoints(0.5)
ExcelObj.ActiveSheet.PageSetup.BottomMargin=Application.InchesToPoints(0.5)
The above code produces a compile error. Can anyone help with the proper syntax?
Thanks.... Rich Lieblich
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only