ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   SaveAs and Hidden Workbooks (https://www.excelbanter.com/excel-programming/318741-saveas-hidden-workbooks.html)

wtpcomplab

SaveAs and Hidden Workbooks
 
When I use the save as command to create a new file,
How do I set the attributes to hidden?
So the Workbook does not show up in the explorer window.

Workbooks.Open Filename:= _
"C:\Documents and Settings\All Users\Documents\" & _
"OFFICE SKILLS\Invoice_AND_Total_Sheet.xls "

Workbooks("Invoice_AND_Total_Sheet.xls").SaveAs _
FolderNme & _
"\" & "Invoice_AND_Total_Sheet.xls"
Workbooks("Invoice_AND_Total_Sheet.xls").Close

Dave Peterson[_5_]

SaveAs and Hidden Workbooks
 
Take a look at the SetAttr command in VBA's help:

dim myfilename as string
myfilename = FolderNme & "\" & "Invoice_AND_Total_Sheet.xls"
'open, save, close
SetAttr myfilename, vbHidden

But if you're only opening it to save it to a different location, take a look at
FileCopy in VBA's help.

You could just copy it to the new location.

===
Just an aside: I show all files in windows explorer--including hidden. So this
technique may not be 100% effective.




wtpcomplab wrote:

When I use the save as command to create a new file,
How do I set the attributes to hidden?
So the Workbook does not show up in the explorer window.

Workbooks.Open Filename:= _
"C:\Documents and Settings\All Users\Documents\" & _
"OFFICE SKILLS\Invoice_AND_Total_Sheet.xls "

Workbooks("Invoice_AND_Total_Sheet.xls").SaveAs _
FolderNme & _
"\" & "Invoice_AND_Total_Sheet.xls"
Workbooks("Invoice_AND_Total_Sheet.xls").Close


--

Dave Peterson


All times are GMT +1. The time now is 09:56 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com