| A Macro to Open
a New Workbook,
then Hide and Save it |
|||||||||||
| Back
to Macro
List of Topics |
|||||||||||
| Home | |||||||||||
|
|
There times when
you desired to create a new workbook, and then save it as a hidden file.
But once you hide a file, it is difficult to save the file as it is not
the active workbook.
The manual procedures for this would be:
Windows Hide (in the menu) The following macros will
allow you to open a new workbook, do something in the workbook, hide it,
then save it.
2 Newbook.Activate 3 DoSomething 4 ActiveWindow.Visible = False 5 Newbook.SaveAs filename:="defaultstuff.xls" Line 1--Adds a new workbook
and "Sets" it with a name of Newbook. Any valid name can used in place
of Newbook
By setting the new
workbook with a name (Newbook), line 5 is very specific about what workbook
to save. Remember, the file must be hidden when saved in order for Excel
to remember that it should be hidden (if it's hidden when saved, it will
be hidden the next time it's opened. And since it is hidden, the usual
commands such as ActiveWorkbook.Save will not work.
Additional Comments:
Why would someone need
do this?
This macro will work in all
Versions of Excel, beginning with Excel 5. However, do not use a
long file name if you are using Excel 5.
|
||||||||||
| Top |