Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Excel Automation Question: Insert a row
Message
From
09/04/2007 07:16:53
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
08/04/2007 16:42:32
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
01213304
Message ID:
01213382
Views:
24
This message has been marked as a message which has helped to the initial question of the thread.
>I am trying to insert a row into a spreadsheet. I am most of the way there but need some help...
>
>I have an object references to Excel, the workbook, and the selected worksheet:
> loExcel
> loWorkbook
> loWorkSheet
>
>
>I want to insert some rows after a given row, let's say row 8, so I issue:
> loWorksheet.Range("A8").Select
>
>Then I insert a row:
> loExcel.Selection.EntireRow.Insert()
>
> The above line of code works, but it inserts a row using the characteristics of the previous row. I want to insert a row using the characteristics of the following row.
> Using the macro recorder, I found that Excel inserts using the characteristics of the following row like this:
>
>Selection.EntireRow.Insert , CopyOrigin:=xlFormatFromRightOrBelow
>
>But I cannot figure out how to convert this Excel syntax to a syntax that VFP will accept.
>
>
>
>Also, is there a way to insert multiple lines at one time rather than one row at a time? I will know in advance how many rows I want to insert and it would be nice to be able to tell Excel: "please insert 500 rows" rather than ask Excel 500 times to insert 1 row.
>
>Many thanks in advance.
#define xlFormatFromLeftOrAbove                           0
#define xlFormatFromRightOrBelow                          1

  loWorkSheet.Range('A8').EntireRow.Insert(,xlFormatFromRightOrBelow)
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform