Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Adding a Title to a Worksheet in Excel
Message
 
To
18/05/2003 02:02:16
General information
Forum:
Visual FoxPro
Category:
Third party products
Miscellaneous
Thread ID:
00789759
Message ID:
00789795
Views:
34
This message has been marked as the solution to the initial question of the thread.
>Hi Terry,
>
>Thanks for the suggestion. I had tried that because that is the code that I got from recording a macro.
>
>But it returns the error: "Unkown name". So it might work as a Excel macro but not as a VBA command issued from VFP.
>
>Have a nice day.

Okay - lets try again. This works with a new sheet - check to make sure you closed your parens.
oldOnError=on('error')
on Error oExcel=.NULL.
oExcel=getobject(,'Excel.Application')
on error &oldOnError
if isnull(oExcel)
   oExcel=createobject('Excel.Application')
endif
With oExcel
.WorkBooks.Add
.displayalerts=.f.
nWorkBookSheets=.Sheets.Count
for c=nWorkBookSheets to 2 step -1
.sheets(c).delete
endfor
.Cells(1,1).Value=[Insert row above this line]
.Range("A1").Select
.Selection.EntireRow.Insert
oExcel.Visible=.t.
endwith
Imagination is more important than knowledge
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform