Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Some easy (for others) VFP to Excel commands
Message
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Title:
Some easy (for others) VFP to Excel commands
Miscellaneous
Thread ID:
00347041
Message ID:
00347041
Views:
92
I am having some trouble with some relatively easy commands when controlling excel via VFP.

1.) First I am try to insert three rows at the top. If I record an excel macro I get:

Rows("1:3").Select
Selection.Insert Shift:=xlDown

In vfp I am trying

WITH .ActiveWorkbook.ActiveSheet
.Rows("1:3").Select
.select.Insert Shift = xlDown -- error here
endwith

Also tried a whole bunch of combinations and I couldn't get it to work. (xldown comes from the included excel.h file)


2.) I also had some trouble with entering formaulas. The excel macro shows for entering the date:

Range("B1").Select
ActiveCell.FormulaR1C1 = "=TODAY()"
Selection.NumberFormat = "mmmm d, yyyy"


the correspoding vfp (incorrect) syntax doesn't work

WITH .ActiveWorkbook.ActiveSheet
.Range("B1").Select
.ActiveCell.FormulaR1C1 = "=TODAY()" -- error on this line
.Selection.NumberFormat = "mmmm d, yyyy"
endwith



Any suggestions or advice would be greatly appreciated.

Thanks,

Kevin
Kevin Emmrich
www.jkt9000.com
Next
Reply
Map
View

Click here to load this message in the networking platform