Hello!

I have a problem with the VBScript syntax. I found this
here in this group:

"---VBA supports named argument syntax (e.g., ArgName:="argvalue") in
method calls. In WSH hosted VBScript, you have to code all arguments
as positional arguments since named argument syntax is not supported."

It describes exactly my problem. But what is the syntax of those
"positional arguments" in VBScript / WSH ?

The following code from Excel VBA is:

Sheets("Tabelle2").Select
Sheets("Tabelle2").Move After:=Sheets(3)


There are three sheets in an Excel workbook with the names
"Tabelle1", "Tabelle2" and "Tabelle3".
The code above just moves the second sheet from the second
position to the last, in VBA.
But what code do I have to write in VBScript ?
What is the syntax in VBScript when the method of the
Excel.Application object awaits an named argument named "After" ?

Thanks for any help!

Best Regards,
Gernot Mulisch

Re: VBScript and "positional arguments" in VBA object methods by Christoph

Christoph
Wed Mar 16 07:44:10 CST 2005

16.03.2005 01:02, Gernot Mulisch schrieb:
> Hello!
>
> I have a problem with the VBScript syntax. I found this
> here in this group:
>
> "---VBA supports named argument syntax (e.g., ArgName:="argvalue") in
> method calls. In WSH hosted VBScript, you have to code all arguments
> as positional arguments since named argument syntax is not supported."
>
> It describes exactly my problem. But what is the syntax of those
> "positional arguments" in VBScript / WSH ?
>
> The following code from Excel VBA is:
>
> Sheets("Tabelle2").Select
> Sheets("Tabelle2").Move After:=Sheets(3)
>
>
> There are three sheets in an Excel workbook with the names
> "Tabelle1", "Tabelle2" and "Tabelle3".
> The code above just moves the second sheet from the second
> position to the last, in VBA.
> But what code do I have to write in VBScript ?
> What is the syntax in VBScript when the method of the
> Excel.Application object awaits an named argument named "After" ?

You have to take a look into the documentation of the Method.
A Range-obejcts Move-method has this signature:

Object.Move(Before, After)

So in VBS a call using positional order of arguments looks like
this ommiting the first argument "before":

Sheets("Tabelle2").Move , Sheets(3)




--
Gruesse, Christoph

Rio Riay Riayo - Gordon Sumner, 1979