Hello,

The situation in my code: VB has reached the last row for data entry in an
excel spreadsheet's current worksheet. Prior arrangement requires me to
start data entry on a new sheet.

The task I need to accomplish: Get VB to copy the current sheet (then I can
blank out filled cells to start afresh), or (preferably) open the blank
template, and copy out the empty sheet to existing .xls file (move to end).
Then finally, I need to close the .xlt and set focus on new sheet in .xls.

Also, I need to just switch easily between sheets inside the .xls.

I've copied below the required code in VBE:

Workbooks.Open Filename:= _
"C:\Documents and Settings\user\My Documents\MyTemplate.xlt",
Editable:= _
True
Sheets("Sheet1").Copy After:=Workbooks("MySheet.xls").Sheets(1)
ActiveWindow.ActivateNext
ActiveWindow.Close

Anyone have some ideas about converting the above to VB?

Much Thanks,

Re: Excel Sheet manipulation from VB by mr_unreliable

mr_unreliable
Wed Apr 12 11:49:53 CDT 2006

Stan, the secret of converting vba to vbs is that vbs doesn't
support "named arguments". Otherwise it is pretty much the
same.

I suggest you look up the parameters for the methods you are
using, and then re-write your code supplying _ALL_ the required
parameters _in order_. For those parameters you wish to skip
just include a comma.

cheers, jw
____________________________________________________________

You got questions? WE GOT ANSWERS!!! ..(but,
no guarantee the answers will be applicable to the questions)


Stan S. wrote:
> Hello,
>
> The situation in my code: VB has reached the last row for data entry in an
> excel spreadsheet's current worksheet. Prior arrangement requires me to
> start data entry on a new sheet.
>
> The task I need to accomplish: Get VB to copy the current sheet (then I can
> blank out filled cells to start afresh), or (preferably) open the blank
> template, and copy out the empty sheet to existing .xls file (move to end).
> Then finally, I need to close the .xlt and set focus on new sheet in .xls.
>
> Also, I need to just switch easily between sheets inside the .xls.
>
> I've copied below the required code in VBE:
>
> Workbooks.Open Filename:= _
> "C:\Documents and Settings\user\My Documents\MyTemplate.xlt",
> Editable:= _
> True
> Sheets("Sheet1").Copy After:=Workbooks("MySheet.xls").Sheets(1)
> ActiveWindow.ActivateNext
> ActiveWindow.Close
>
> Anyone have some ideas about converting the above to VB?
>
> Much Thanks,