Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel Formatting

Status
Not open for further replies.

grads

Programmer
Feb 2, 2001
11
0
0
US
I am trying to format an excel document from VFP 6. I am trying to inset blank lines into my excel document using this command, Selection.Insert Shift:=-4121, which I obtained by running a macro in excel. When I attempt to run this code form foxpro I get a syntax error. Has anyone run across this issue or no another way to insert blank lines from foxpro into excel?
 
The following inserts blanks at the specified range while shifting down everything at that point.

loExcel = createobject("Excel.Application")
loExcel.visible = .t.
loWorkBk = loExcel.Workbooks.add
for i = 0 to 5
lcRow = chr(65+i) + "1"
loWorkBk.Worksheets("Sheet1").range(lcRow) = "Test"+allt(str(i+1))
next
loWorkBk.Worksheets("Sheet1").Range("A1:D1").Insert

I haven't figured out how to make a whole row shift yet, but this may help.


Darrell 'We all must do the hard bits so when we get bit we know where to bite' :)
 
Selection.Insert Shift:=-4121 sample you posted is visual basic. all the code samples in help files for dll's and activeX controls are in visual basic. when using the macro generator in excel, it provides a good guide, but has to be converted.

look in the FAQ184-2215, FAQ184-2259, FAQ184-2257 AND others. Attitude is Everything
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top