|
-
Oct 13th, 2003, 06:01 AM
#1
Thread Starter
New Member
Excel in VBScript *RESOLVED*
Hi
I'm trying to use vbscript to do some excel formatting. I'm using late binding within vbscript and have figured out how to write parameters after excel methods/properties using the Const value.
e.g.
.ActiveWorkbook.SaveAS "filename", -4143
However, I am having trouble with moving an excel worksheet within an open workbook. The VBA code is similair to this:
Sheets("Sheet2").Select
Sheets("Sheet2").Move Before:=Sheets(1)
Does anyone know what the code shouldlook like in VBScript - it's the Before part that is giving me trouble.
many thanks
Last edited by R00tj00se1; Oct 14th, 2003 at 04:12 AM.
-
Oct 13th, 2003, 07:44 PM
#2
Fanatic Member
You don't need the "Before:=" part because the first parameter after Move if the Before value. Also, you don't need to select the sheet before moving it. VBScript may also want to have the Sheet prefaced by a Workbook. Try this:
VB Code:
ActiveWorkbook.Sheets("Sheet2").Move ActiveWorkbook.Sheets(1)
-
Oct 14th, 2003, 04:08 AM
#3
Thread Starter
New Member
Thanks WorkHorse - I should have been able to work this out but I think my brain was fried. Your answer pointed me in the right direction. Instead of:
ActiveWorkbook.Sheets("Sheet2").Move ActiveWorkbook.Sheets(1)
vbscript seems to want:
With oxl
ActiveWorkbook.Sheets("Sheet2").Move oxl.ActiveWorkbook.Sheets(1)
End with
(where oxl is the reference to the excel object)
The parameter has to have oxl. otherwise vbscript thinks ActiveWorkBook is a variable.
many thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|