Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rename the Active WorkBook? 1

Status
Not open for further replies.

prismtx

IS-IT--Management
Apr 9, 2001
59
US
I have a macro to import external data and split it to 4 different work sheets, but I end up with a generic name displaying at the top of the screen like Book1 or Book2, etc.

Is there a way I can rename the active Workbook to "Daily Report"?

I tried ActiveWorkbook.Name = "Daily Report", but I get a compile error that it can't assign to a read-only property.
 
Have a look at the SaveAs method.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 




Hi,

Just another tip, to reinforce what PHV has suggested.

Use your macro recorder. Turn it on, do a File > SaveAs.

Using the macro recorder ought to be the FIRST thing that you do when generating most code.

Then you take the generated code and modify it to suite your requirements.

Skip,

[glasses]Did you hear what happened when the OO programmer lost his library?...
He's now living in OBJECT poverty![tongue]
 
I looked at the SaveAs method, but it forced a rewrite of the workbook, which is something the user may not want to do every day. Is there any way to do it without actually saving the workbook?
 


"...but it forced a rewrite of the workbook..."

What does that mean?

Skip,

[glasses]Did you hear what happened when the OO programmer lost his library?...
He's now living in OBJECT poverty![tongue]
 
I only want the name at the top of the screen to show that they are looking at the Daily Report file. It is imported from a csv file and I do a "Save As", it is writing a second copy to their drive. I don't know if they want to save a copy or where they would want to save it to.

If it can't be done, its not that big of an issue. I'll just tell them that the screen will show a generic name.

Thanks!
 

"I end up with a generic name displaying at the top of the screen like Book1 or Book2, etc."

Exactly WHAT do you want???????

" It is imported from a csv file "

a CSV is NOT a workbook.

Skip,

[glasses]Did you hear what happened when the OO programmer lost his library?...
He's now living in OBJECT poverty![tongue]
 
Hi Skip,
Yes, I know that a csv is not a workbook. This is the first Excel macro that I have done and I was changing the names of the Generic Sheet1, Sheet2, etc. So I was just wondering if there was some simple statement that I was missing to rename the workbook from Book1 to "Daily Report".

Since there isn't a way to change it without actually writing it to disk, I will tell the people who will be using it that they can do it themselves.

Thanks.
 



NO!

Skip,

[glasses]Did you hear what happened when the OO programmer lost his library?...
He's now living in OBJECT poverty![tongue]
 



Why not just have a workbook named DailyReport.xls.

In the workbook, you import whatever csv(s) is(are) required.

Skip,

[glasses]Did you hear what happened when the OO programmer lost his library?...
He's now living in OBJECT poverty![tongue]
 
Why not just have a workbook named DailyReport.xls.

In the workbook, you import whatever csv(s) is(are) required."

I'm thinking that will be the best way to go!

Thanks.
 




Check out Data > Import External Data > Import Data wizard.


Skip,

[glasses]Did you hear what happened when the OO programmer lost his library?...
He's now living in OBJECT poverty![tongue]
 
You can try

ActiveWindow.Caption = "Daily Report"

in you macro

ck1999
 



ck, I learned something! THANX! ==> *

Skip,

[glasses]Did you hear what happened when the OO programmer lost his library?...
He's now living in OBJECT poverty![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top