List Info

Thread: VBA Excel Question




VBA Excel Question
country flaguser name
United States
2008-02-29 06:18:36

Folks,

I am trying to create a new sheet and rename it. However, I am running into
an error #9.

Here is what I am using:

Dim sInputResponse As String

sInputResponse = InputBox("Enter a sheet name:";)

Application.Sheets(";Sheet1").Name = sInputResponse

The problem is the "Sheet1". If I create the sheet and delete it then I try
to create another sheet, Excel automatically calls this second sheet Sheet2.
So how can I instead of applying the sheet name statically, use something
like activesheet.name = bla bla. I can keep aggregating the sheet number,
but I'd rather avoid that.

[Non-text portions of this message have been removed]

__._,_.___
.

__,_._,___
Re: VBA Excel Question
country flaguser name
United States
2008-02-29 23:27:56

I think there is a "currentsheet" property that is an object
representing the currently selected sheet. Look at that and set it's
name instead.

Joel

Jean-Pierre Jamous wrote:
>
> Folks,
>
> I am trying to create a new sheet and rename it. However, I am running
> into
>; an error #9.
>
> Here is what I am using:
>
> Dim sInputResponse As String
>
> sInputResponse = InputBox("Enter a sheet name:";)
>
> Application.Sheets("Sheet1").Name = sInputResponse
>
> The problem is the "Sheet1". If I create the sheet and delete it then
> I try
> to create another sheet, Excel automatically calls this second sheet
> Sheet2.
> So how can I instead of applying the sheet name statically, use something
> like activesheet.name = bla bla. I can keep aggregating the sheet number,
> but I'd rather avoid that.
>
> [Non-text portions of this message have been removed]
>
>;

__._,_.___
.

__,_._,___
Re: VBA Excel Question
country flaguser name
United States
2008-02-29 08:08:23

Hi Jean-Pierre,

You are on the right track. The following line will do the trick:

ActiveSheet.Name = sInputResponse

When you insert a new worksheet, it will become the active sheet.

Hope this helps
Raymond

"Jean-Pierre Jamous&quot; < CEO%40Jamous.biz">CEOJamous.biz>
Sent by: visualbasic6programming%40yahoogroups.com">visualbasic6programmingyahoogroups.com
02/29/2008 07:18 AM

Folks,

I am trying to create a new sheet and rename it. However, I am running
into
an error #9.

Here is what I am using:

Dim sInputResponse As String

sInputResponse = InputBox(&quot;Enter a sheet name:";)

Application.Sheets(";Sheet1&quot;).Name = sInputResponse

The problem is the "Sheet1". If I create the sheet and delete it then I
try
to create another sheet, Excel automatically calls this second sheet
Sheet2.
So how can I instead of applying the sheet name statically, use something
like activesheet.name = bla bla. I can keep aggregating the sheet number,
but I'd rather avoid that.

[Non-text portions of this message have been removed]

__._,_.___
.

__,_._,___
roll back printer paper
country flaguser name
United States
2008-03-02 00:27:09

(VB6 coding help required):
After printing a document the printer should eject certain distance
(for tearing the paper).

After tearing that printed document; so we can use the non printed
area (the length skiped for

cutting the printed matter) while we are using continues paper (Roll /
Holl Papper). For this

purpose I have to be rollback the printer to the initial position. I
am using LPT1 coding. How

can I roll back the paper for certian distance to initialize it at the
top? Please Help.

__._,_.___
.

__,_._,___
Using USB port in vb6
country flaguser name
United States
2008-03-02 00:36:01

I am using LPT1 printer port in vb6. But Now I have a problem that is
how to use USB printer port directly from vb6?
Using LPT1 port the code looks like:
Open "LPT1" for output at #1
print #1, "String"
close #1
how can I transfer this code th usb port?
plz help.

__._,_.___
.

__,_._,___
[1-5]

about | contact  Other archives ( Real Estate discussion Medical topics )