LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Newbie: Can't delete to left with WScript

I'm a complete MS newbie trying to automate some processing of Excel
worksheets. I can insert values fine, but deleting doesn't work.

Here is my script, which I'm running via the Windows Script Host:


set xapp = WScript.CreateObject("Excel.Application")
xapp.Visible = True
set workbook = xapp.Workbooks.Open("Z:\home\dwake\Test.xls")
set worksheet = workbook.Worksheets("sheet1")
worksheet.Cells(1,1).Value = "Test"
worksheet.Cells(1,1).Value = "Test2"
worksheet.Range("A1:A2").Delete Shift:=xlToLeft 'this line causes problems
workbook.save()
workbook.Close(false)
xapp.Quit()


Everything runs fine if I comment out the Delete line. However, with
it I get the following error:

Script: Y:\Test.vbs
Line: 7
Char: 39
Error: Expected Statement
Code: 800A0400
Source: Microsoft VBScript compilation error.

What am I doing wrong, and how can I fix it?

Thanks!

David
 
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
using WScript.CreateObject("Wscript.Shell John Keith[_2_] Excel Programming 3 August 30th 05 07:20 PM
delete all text to the left of??? Sheila Excel Worksheet Functions 3 January 25th 05 05:30 PM
delete left 8 characters in many cells jposner Excel Programming 5 May 13th 04 12:10 AM
Office 2003 not able to run wscript?? Gordon Cashmore[_2_] Excel Programming 2 December 19th 03 05:53 PM
WScript object not found (???) Tom Ogilvy Excel Programming 1 July 10th 03 10:59 PM


All times are GMT +1. The time now is 10:56 PM.

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

About Us

"It's about Microsoft Excel"