Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VBA for Excel in VFP Program
Message
From
17/03/2000 12:32:25
Rich Lieblich
Infosys Technologies, Inc.
Fanwood, New Jersey, United States
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Title:
VBA for Excel in VFP Program
Miscellaneous
Thread ID:
00347127
Message ID:
00347127
Views:
51
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
Map
View

Click here to load this message in the networking platform