Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Delete row in Excel 2002 worksheet

In VFP 7, my application can perform the following command correctly using
Excel 2000, but not in Excel 2002:

goExcel = CREATEOBJECT("Excel.Application")
WITH goExcel
.Workbooks.Open(lcXlsName)
.Rows("5:5").Delete
ENDWITH

If I record this task in an Excel Macro and edit it using the Macro Editor,
I get the following:

.Rows("5:5").Select
.Selection.Delete Shift:=PxlUp
.Range("A5").Select

If I add <spaceShift:=PxlUp after the Delete command, the compiler returns
a syntax error.

How can I run Excel commands in VFP 7 like this? What is the correct syntax
for it?

Thanks

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Delete row in Excel 2002 worksheet

Try

goExcel = CREATEOBJECT("Excel.Application")
WITH goExcel
.Workbooks.Open(lcXlsName)
.ActiveSheet.Rows("5:5").Delete
ENDWITH

The constant doesn't have a "P" in it

? xlshiftup
-4162
? xlup
-4162

if you are using late binding, use the number (-4162) instead of the named
constant, but when deleting a row, you don't need it. The only option is to
shift up.

--
Regards,
Tom Ogilvy



"RuthC" wrote in message
...
In VFP 7, my application can perform the following command correctly using
Excel 2000, but not in Excel 2002:

goExcel = CREATEOBJECT("Excel.Application")
WITH goExcel
.Workbooks.Open(lcXlsName)
.Rows("5:5").Delete
ENDWITH

If I record this task in an Excel Macro and edit it using the Macro

Editor,
I get the following:

.Rows("5:5").Select
.Selection.Delete Shift:=PxlUp
.Range("A5").Select

If I add <spaceShift:=PxlUp after the Delete command, the compiler

returns
a syntax error.

How can I run Excel commands in VFP 7 like this? What is the correct

syntax
for it?

Thanks



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 318
Default Delete row in Excel 2002 worksheet

Ruth,
I admit I have not automated Excel from VFP but you may want to try the
following
instead of .Rows(5:5).Delete, try .Rows("5:5").EntireRow.delete

Also the other error you are getting may be due to the wrong constant value
and hence you may like to try
Excel.xlUp instead of PxlUp

Alok Joshi

"RuthC" wrote:

In VFP 7, my application can perform the following command correctly using
Excel 2000, but not in Excel 2002:

goExcel = CREATEOBJECT("Excel.Application")
WITH goExcel
.Workbooks.Open(lcXlsName)
.Rows("5:5").Delete
ENDWITH

If I record this task in an Excel Macro and edit it using the Macro Editor,
I get the following:

.Rows("5:5").Select
.Selection.Delete Shift:=PxlUp
.Range("A5").Select

If I add <spaceShift:=PxlUp after the Delete command, the compiler returns
a syntax error.

How can I run Excel commands in VFP 7 like this? What is the correct syntax
for it?

Thanks

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2002: Can I delete tabs at one go ? Mr. Low Excel Discussion (Misc queries) 2 July 24th 09 05:16 PM
Excel 2002 sp3 Worksheet Password George Excel Discussion (Misc queries) 0 December 5th 07 10:36 PM
Excel 2002 Worksheet: Can I sort the columns ? Mr. Low Excel Discussion (Misc queries) 3 October 6th 07 12:44 AM
Excel 2002 worksheet cmd661 Excel Worksheet Functions 2 February 20th 06 11:02 AM
I cannot delete rows or columns in Excel 2002. How do I fix this? tgs77m Setting up and Configuration of Excel 3 July 12th 05 08:04 PM


All times are GMT +1. The time now is 02:27 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"