Activate the temporary "Book1"

bibux

Board Regular
Joined
Mar 13, 2014
Messages
51
I am trying to activate a "generated" workbook that is unsaved and has no extension, just the name "Book1". If I save it as "Book1.xlsx" and then repoen it, I can refer to it. Like this.

Code:
Set sh = Workbooks("Book1.xlsx").Sheets("Stats")
Set rng = sh.UsedRange

The question is, can I refer to it while it is unsaved and named simply "Book1"? I have tried
Code:
Workbooks.("Book1").Sheets("Stats").Activate
- to no avail.
 
I think I saw "export to Excel" in there, so that answers the first bit.

If yes - can you assure that you will start out with only one instance of Excel, and that the only other instance of Excel will be when the other app creates it,

AND,

that the other instance will only have the one workbook? That is, I am wondering if we could (via code) look for the one other instance and workbooks(1) therein.

I could not glean these from your video.
 
Upvote 0

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
To echo Norie's question a bit, are you "manually" creating the (presumably a report of some type) workbooks whilst using (i.e. - I clicked a button or something) the other application?

If yes - can you assure that you will start out with only one instance of Excel, and that the only other instance of Excel will be when the other app creates it, AND, that the other instance will only have the one workbook? That is, I am wondering if we could (via code) look for the one other instance and workbooks(1) therein.

Mark
The way I'm seeing it is: the main workbook will be open and waiting for "Book1" to be generated. Once "Book1" is ready, with the code from "Main", go to "Book1" and copy/paste the data.
 
Upvote 0

Forum statistics

Threads
1,216,158
Messages
6,129,207
Members
449,493
Latest member
JablesFTW

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top