Thread
:
I learned how to rename workbook without saving it
View Single Post
#
11
Posted to microsoft.public.excel.programming
Don Guillett
external usenet poster
Posts: 10,124
I learned how to rename workbook without saving it
My point was that you may save the fileNAME the file (doesn't move it
unless you tell it to)KILL (look in VBA help index) the original. OR,
listen to Patrick.
--
Don Guillett
Microsoft MVP Excel
SalesAid Software
"Yar Glazkov" wrote in message
...
perfectly finest good :-)
The only trouble with this is:
This program moves and renames FILE. Workbook IS NOT file. You may count
it
as file from the moment workbook is saved.
Reasons why I don't want to save workbook until users want to save
workbook
described before, and I may repeat. English is not the thing I know good
enough and very probably I could not explain those reasons.
I generate report in Excel workbook. I cannot know, if this report is
useful
for user who generated it. After generation, I leave workbook opened and
allow user to edit it, save it, not save it and do with it whatever he
love
to make with workbooks. But if user desire to save the file, I want that
default name for save to be not "Book1", but smth like "South region
transportation budget 2009 II half 2009-06-03 14-13-21" - name, date and
time
of creation.
As far as I understand, there are four alternatives:
1. Not save file. When user solved to save it, he selects "Save" option,
or
"SaveAs" option, gets dialog, and choose name and place where to save
workbook (and file, from the moment of first save). When users first saves
the workbook, its name is "South region transportation budget 2009 II half
2009-06-03 14-13-21" and location (directory) choose where to save it is
user's choice. Also, he may change the name of book. This is I want to
achieve.
1a. Same as 1, but default filename is "Book1". Not good enough, because
user likely will not name the file with date and time (from such sclerosis
initially task was born)
2. Save file under name I like in usual directory, forexample
"z:\documents\shared\YarGlazkov\South region transportation budget 2009 II
half 2009-06-03 14-13-21.xlsx". Not good enough, because user very likely
will not delete this file if he solve not to save it. And directory
YarGlazkov soon is full of garbage
3. Save file in temporary dir, for example c:\temp\South region
transportation budget 2009 II half 2009-06-03 14-13-21. Not good enough,
because if user solve save file, choose "Save" then exit, he will never
find
the file in c:\temp direrctory
Look again: I don't know if i want to save. And when I want to save, I
have
filename that have sence.
"Don Guillett" wrote:
Name Statement Example
This example uses the Name statement to rename a file. For purposes of
this
example, assume that the directories or folders that are specified
already
exist. On the Macintosh, €œHD:€ is the default drive name and portions of
the
pathname are separated by colons instead of backslashes.
Dim OldName, NewName
OldName = "OLDFILE": NewName = "NEWFILE" ' Define file names.
Name OldName As NewName ' Rename file.
OldName = "C:\MYDIR\OLDFILE": NewName = "C:\YOURDIR\NEWFILE"
Name OldName As NewName ' Move and rename file.
Reply With Quote
Don Guillett
View Public Profile
Find all posts by Don Guillett