Excel "Sheet"

Excel "Sheet"

Anonymous
Not applicable
234 Views
6 Replies
Message 1 of 7

Excel "Sheet"

Anonymous
Not applicable
Hi Everybody,

I am wondering if anybody might know if this is possible.

This is all done through VB.
I open Excel.
I open a specific xls file.

Now what I want to know is if I can refer to "sheet 1" even though it is not
called "sheet 1".
There should only be one sheet in my Excel file, and the names of the sheets
will be changing all the time.
Is there a generic "sheet 1" constant I can use?

Or is there a simple method to do this?

Thanks for reading,
Shaun Hesse
0 Likes
235 Views
6 Replies
Replies (6)
Message 2 of 7

Anonymous
Not applicable
> Is there a generic "sheet 1" constant I can use?

Hi Shaun. Have you tried this?:

Set mySheet = xlApp.ActiveWorkbook.ActiveSheet

--
http://www.acadx.com
0 Likes
Message 3 of 7

Anonymous
Not applicable
(EDITED) I am soooo stupid some times!
I must of had too many beers last night.

Thanks for your help Frank, its works perfectly.

>
> Hi Shaun. Have you tried this?:
>
> Set mySheet = xlApp.ActiveWorkbook.ActiveSheet
>
> --
> http://www.acadx.com
>
0 Likes
Message 4 of 7

Anonymous
Not applicable
> I am wondering if anybody might know if this is possible.
>
> This is all done through VB.
> I open Excel.
> I open a specific xls file.
>
> Now what I want to know is if I can refer to "sheet 1" even though it is not
> called "sheet 1".
> There should only be one sheet in my Excel file, and the names of the sheets
> will be changing all the time.
> Is there a generic "sheet 1" constant I can use?

As an alternative to Frank's method you could also look at the collection
object and grab the first wworksheet in there seeing as there's only one
in each workbook.

--
Y-------------------------------------------------------------------+
| Darren J. Young | Minnesota CADWorks, Inc. |
| dyoung@mcwi.com | P.O. Box 7293 |
| ftp://ftp.mcwi.com | St. Cloud, Minnesota 56302-7293 |
| http://www.mcwi.com | Phone 1-320-654-9053 |
| CAD/CAM/CNC - Drafting Design Customization Training Programming |
0,0-----------------------------------------------------------------X
Support the amendment to ban commercial unsolicited Email (SPAM) To
join the fight, visit -> http://www.cauce.org/
0 Likes
Message 5 of 7

Anonymous
Not applicable
Shaun,

Im an Excel expert and I could help you with this problem. But, I see that
you were already helped.

Anyways, I just noticed your name and almost freaked out!!!

Check my name out.

Adios,

Shawn Haase

"Shaun Hesse" wrote in message
news:8A68745A72D5F0A422F698E4FD1125B5@in.WebX.maYIadrTaRb...
> Hi Everybody,
>
> I am wondering if anybody might know if this is possible.
>
> This is all done through VB.
> I open Excel.
> I open a specific xls file.
>
> Now what I want to know is if I can refer to "sheet 1" even though it is
not
> called "sheet 1".
> There should only be one sheet in my Excel file, and the names of the
sheets
> will be changing all the time.
> Is there a generic "sheet 1" constant I can use?
>
> Or is there a simple method to do this?
>
> Thanks for reading,
> Shaun Hesse
>
0 Likes
Message 6 of 7

Anonymous
Not applicable
> Im an Excel expert

I like your style. 😉

--
http://www.acadx.com
0 Likes
Message 7 of 7

Anonymous
Not applicable
Should I have said instead: "I am dangerous with Excel yet trustworthy"???

lol!!!

:)
SKH

"Frank Oquendo" wrote in message
news:f048c3d.4@WebX.maYIadrTaRb...
> > Im an Excel expert
>
> I like your style. 😉
>
> --
> http://www.acadx.com
>
0 Likes