Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 69
Default How to "unnamed" workbook.


I have an opened workbook which was saved by a user.
Now I need to treat this workbook as a new, so after clicking File/Save
(not Save as) Excel will open dialog window to provide filename.

Is there any way to do this from VBA?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default How to "unnamed" workbook.

Look in Excel help at the beforeSave event.

http://www.cpearson.com/excel/events.htm

you would cancel the save by setting

Cancel = True
then disable events
Application.EnableEvents = False
then put up the saveas dialog

fname = Application.GetSaveAsFileName

then save the file if the name is acceptable

thisworkbook.SaveAs fname

reenable events
Application.EnableEvents = True

--
Regards,
Tom Ogilvy



"witek" wrote:


I have an opened workbook which was saved by a user.
Now I need to treat this workbook as a new, so after clicking File/Save
(not Save as) Excel will open dialog window to provide filename.

Is there any way to do this from VBA?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 69
Default How to "unnamed" workbook.

It is more complicated.

Code is somewhere else that workbook which is open, so I can't use any
events which apply to that workbook.


the idea is like below


wbk = workbooks.Add
wbk.saveas "temp"


now wbk remians open with "temp" as a name, but I need it as "noname".
There is no VBA code in "temp" file.








Tom Ogilvy wrote:
Look in Excel help at the beforeSave event.

http://www.cpearson.com/excel/events.htm

you would cancel the save by setting

Cancel = True
then disable events
Application.EnableEvents = False
then put up the saveas dialog

fname = Application.GetSaveAsFileName

then save the file if the name is acceptable

thisworkbook.SaveAs fname

reenable events
Application.EnableEvents = True

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default How to "unnamed" workbook.

I have an opened workbook which was saved by a user.
was your original problem statement. You have now contradicted that.

If you determine what your actual situation is, then certainly, post back.

If a workbook has been saved, then it will have a name. Possibly you are
looking for a template.

--
Regards,
Tom Ogilvy


"witek" wrote:

It is more complicated.

Code is somewhere else that workbook which is open, so I can't use any
events which apply to that workbook.


the idea is like below


wbk = workbooks.Add
wbk.saveas "temp"


now wbk remians open with "temp" as a name, but I need it as "noname".
There is no VBA code in "temp" file.








Tom Ogilvy wrote:
Look in Excel help at the beforeSave event.

http://www.cpearson.com/excel/events.htm

you would cancel the save by setting

Cancel = True
then disable events
Application.EnableEvents = False
then put up the saveas dialog

fname = Application.GetSaveAsFileName

then save the file if the name is acceptable

thisworkbook.SaveAs fname

reenable events
Application.EnableEvents = True


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 69
Default How to "unnamed" workbook.

opened workbook, doesn't mean that I can write any code to it.

1.
Workbook is created from VBA code from scratch, but VBA code is in add-in.
For some reasons this newly created workbook must be saved.
After that if user saves it, it is saved under the temporary name chosen
by me.
I don't want to and I can't force Save As option.
I would like to have it as a noname even if I saved it before.

2. if user saved using his own name, he needs option to leave it open as
a noname, so next time choosing File/Save Excel will ask for a name.

What I need is option like ActiveWorkbook.FullName = ""

Is it clear now?




Tom Ogilvy wrote:
I have an opened workbook which was saved by a user.


was your original problem statement. You have now contradicted that.

If you determine what your actual situation is, then certainly, post back.

If a workbook has been saved, then it will have a name. Possibly you are
looking for a template.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default How to "unnamed" workbook.

witek,
..SaveCopyAs ?

NickHK

"witek" wrote in message
...
opened workbook, doesn't mean that I can write any code to it.

1.
Workbook is created from VBA code from scratch, but VBA code is in

add-in.
For some reasons this newly created workbook must be saved.
After that if user saves it, it is saved under the temporary name chosen
by me.
I don't want to and I can't force Save As option.
I would like to have it as a noname even if I saved it before.

2. if user saved using his own name, he needs option to leave it open as
a noname, so next time choosing File/Save Excel will ask for a name.

What I need is option like ActiveWorkbook.FullName = ""

Is it clear now?




Tom Ogilvy wrote:
I have an opened workbook which was saved by a user.


was your original problem statement. You have now contradicted that.

If you determine what your actual situation is, then certainly, post

back.

If a workbook has been saved, then it will have a name. Possibly you

are
looking for a template.



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 69
Default How to "unnamed" workbook.

SaveCopyAs creates a copy and doesn't save current workbook.
Problem is that current workbook must be saved, not simply its copy
created. Why? Because of bug in Excel.




NickHK wrote:
witek,
.SaveCopyAs ?

NickHK

"witek" wrote in message
...

opened workbook, doesn't mean that I can write any code to it.

1.
Workbook is created from VBA code from scratch, but VBA code is in


add-in.

For some reasons this newly created workbook must be saved.
After that if user saves it, it is saved under the temporary name chosen
by me.
I don't want to and I can't force Save As option.
I would like to have it as a noname even if I saved it before.

2. if user saved using his own name, he needs option to leave it open as
a noname, so next time choosing File/Save Excel will ask for a name.

What I need is option like ActiveWorkbook.FullName = ""

Is it clear now?




Tom Ogilvy wrote:

I have an opened workbook which was saved by a user.

was your original problem statement. You have now contradicted that.

If you determine what your actual situation is, then certainly, post


back.

If a workbook has been saved, then it will have a name. Possibly you


are

looking for a template.




  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default How to "unnamed" workbook.

SaveCopyAs does not require that the workbook be saved.


"witek" wrote in message
...
SaveCopyAs creates a copy and doesn't save current workbook.
Problem is that current workbook must be saved, not simply its
copy created. Why? Because of bug in Excel.




NickHK wrote:
witek,
.SaveCopyAs ?

NickHK

"witek" wrote in message
...

opened workbook, doesn't mean that I can write any code to it.

1.
Workbook is created from VBA code from scratch, but VBA code
is in


add-in.

For some reasons this newly created workbook must be saved.
After that if user saves it, it is saved under the temporary
name chosen
by me.
I don't want to and I can't force Save As option.
I would like to have it as a noname even if I saved it before.

2. if user saved using his own name, he needs option to leave
it open as
a noname, so next time choosing File/Save Excel will ask for
a name.

What I need is option like ActiveWorkbook.FullName = ""

Is it clear now?




Tom Ogilvy wrote:

I have an opened workbook which was saved by a user.

was your original problem statement. You have now
contradicted that.

If you determine what your actual situation is, then
certainly, post


back.

If a workbook has been saved, then it will have a name.
Possibly you


are

looking for a template.




  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 69
Default How to "unnamed" workbook.

But it is not that case.
Once again.
There is a workbook which has a name assigned to it. So File/Save will
not ask for name.
I need to remove filename, so next time when user will try to save it by
choosing File/Save Excel should display SaveAs dialog box.

Making copies, forcing Save as doesn't solves the problem.



Chip Pearson wrote:
SaveCopyAs does not require that the workbook be saved.


"witek" wrote in message
...

SaveCopyAs creates a copy and doesn't save current workbook.
Problem is that current workbook must be saved, not simply its
copy created. Why? Because of bug in Excel.




NickHK wrote:

witek,
.SaveCopyAs ?

NickHK

"witek" wrote in message
...


opened workbook, doesn't mean that I can write any code to it.

1.
Workbook is created from VBA code from scratch, but VBA code
is in

add-in.


For some reasons this newly created workbook must be saved.
After that if user saves it, it is saved under the temporary
name chosen
by me.
I don't want to and I can't force Save As option.
I would like to have it as a noname even if I saved it before.

2. if user saved using his own name, he needs option to leave
it open as
a noname, so next time choosing File/Save Excel will ask for
a name.

What I need is option like ActiveWorkbook.FullName = ""

Is it clear now?




Tom Ogilvy wrote:


I have an opened workbook which was saved by a user.

was your original problem statement. You have now
contradicted that.

If you determine what your actual situation is, then
certainly, post

back.


If a workbook has been saved, then it will have a name.
Possibly you

are


looking for a template.




  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default How to "unnamed" workbook.

If you save as a template then the user would be asked to rename it or it
would be given a name + 1,2, (next sequence number)

--
Wendell A. Clark, BS
-------------------------------------

CONFIDENTIALITY NOTICE: This e-mail communication and any attachments may
contain confidential and privileged information for the use of the
designated recipients named above. If you are not the intended recipient,
please notify us by reply e-mail. You are hereby notified that you have
received this communication in error and that any review, disclosure,
dissemination, distribution or copying of it or its contents is prohibited.
If you have received this communication in error, please destroy all copies
of this communication and any attachments. Contact the sender if it
continues.


"witek" wrote in message
...

I have an opened workbook which was saved by a user.
Now I need to treat this workbook as a new, so after clicking File/Save
(not Save as) Excel will open dialog window to provide filename.

Is there any way to do this from VBA?





  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default How to "unnamed" workbook.

witek,
If it has been saved, you cannot *UnSave* it.
What you are asking makes no sense.

NickHK

"witek" wrote in message
...
But it is not that case.
Once again.
There is a workbook which has a name assigned to it. So File/Save will
not ask for name.
I need to remove filename, so next time when user will try to save it by
choosing File/Save Excel should display SaveAs dialog box.

Making copies, forcing Save as doesn't solves the problem.



Chip Pearson wrote:
SaveCopyAs does not require that the workbook be saved.


"witek" wrote in message
...

SaveCopyAs creates a copy and doesn't save current workbook.
Problem is that current workbook must be saved, not simply its
copy created. Why? Because of bug in Excel.




NickHK wrote:

witek,
.SaveCopyAs ?

NickHK

"witek" wrote in message
...


opened workbook, doesn't mean that I can write any code to it.

1.
Workbook is created from VBA code from scratch, but VBA code
is in

add-in.


For some reasons this newly created workbook must be saved.
After that if user saves it, it is saved under the temporary
name chosen
by me.
I don't want to and I can't force Save As option.
I would like to have it as a noname even if I saved it before.

2. if user saved using his own name, he needs option to leave
it open as
a noname, so next time choosing File/Save Excel will ask for
a name.

What I need is option like ActiveWorkbook.FullName = ""

Is it clear now?




Tom Ogilvy wrote:


I have an opened workbook which was saved by a user.

was your original problem statement. You have now
contradicted that.

If you determine what your actual situation is, then
certainly, post

back.


If a workbook has been saved, then it will have a name.
Possibly you

are


looking for a template.






  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 69
Default How to "unnamed" workbook.

NickHK wrote:
witek,
If it has been saved, you cannot *UnSave* it.
What you are asking makes no sense.

I thought that maybe I can.
It makes sense, simply there is no function which allows to do that.
  #13   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 69
Default How to "unnamed" workbook.

Wendell A. Clark wrote:
If you save as a template then the user would be asked to rename it or it
would be given a name + 1,2, (next sequence number)


ActiveWorkbook.SaveAs "aaa", xlTemplate
ActiveWorkbook.Close
Workbooks.Open "aaa"


It makes sense. It is similar to what I wanted to achive. Thanks.
  #14   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default How to "unnamed" workbook.

If a workbook has been saved, then it will have a name. Possibly you are
looking for a template.


--
Regards,
Tom Ogilvy

"witek" wrote in message
...
Wendell A. Clark wrote:
If you save as a template then the user would be asked to rename it or

it
would be given a name + 1,2, (next sequence number)


ActiveWorkbook.SaveAs "aaa", xlTemplate
ActiveWorkbook.Close
Workbooks.Open "aaa"


It makes sense. It is similar to what I wanted to achive. Thanks.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
Excel 2003 VBA - "Maximizing" Window & "Calculating" Workbook JingleRock Excel Programming 0 April 25th 06 05:04 AM
Backup to specific folder if workbook names begins with "NSR" or "MAC" GregR Excel Programming 3 May 6th 05 12:24 AM
save and restore "Workbook Menu Bar" & "Cell" menus Jeff Higgins Excel Programming 2 February 14th 05 01:33 AM
Adding "New" "Insert" "Delete" into a workbook to change from data 1 to data 2 etc Bob Reynolds[_2_] Excel Programming 0 March 4th 04 08:52 PM


All times are GMT +1. The time now is 01:12 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"