Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Hiding an Excel file using VBA

Hi,
I am using Excel 2003.

Is it possible for me to so save an Excel file within VBA so that it is not
visible in the folder it is saved in?
This is an extract of the code I have which currently saves the file:

ActiveWorkbook.SaveAs Filename:="\purchases\ " & name & ".xls", _
FileFormat:=xlNormal, Password:="", WriteResPassword:="xxx", _
ReadOnlyRecommended:=False, CreateBackup:=False

I know once the file has been saved I can set the file properties to hidden
which works but didn't know whether or not it was possible within VBA.

Thanks very much


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,549
Default Hiding an Excel file using VBA

Try the following with the correct file path...
'---
Sub OutOfSight()
Dim strPath As String
strPath = "C:\SomeFolder\AnotherFolder\SomeFileName.xls"
Call TheShadowKnows(strPath)
End Sub
'---
Function TheShadowKnows(ByRef FileLocation As String) As Boolean
Dim fso As Object
Dim f As Object
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFile(FileLocation)
If Not f.Attributes And 2 Then f.Attributes = f.Attributes + 2
Set f = Nothing
Set fso = Nothing
End Function
'---
More on the FileSystemObject here...
http://www.microsoft.com/downloads/e...displaylang=en
'---
Jim Cone
Portland, Oregon USA
http://www.mediafire.com/PrimitiveSoftware
(List Files XL add-in: finds and lists files/folders with hyperlinks)





"Steve Jones"

wrote in message
...
Hi,
I am using Excel 2003.

Is it possible for me to so save an Excel file within VBA so that it is not visible in the folder
it is saved in?
This is an extract of the code I have which currently saves the file:

ActiveWorkbook.SaveAs Filename:="\purchases\ " & name & ".xls", _
FileFormat:=xlNormal, Password:="", WriteResPassword:="xxx", _
ReadOnlyRecommended:=False, CreateBackup:=False

I know once the file has been saved I can set the file properties to hidden which works but didn't
know whether or not it was possible within VBA.

Thanks very much



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
hiding excel Charlie Excel Programming 2 January 3rd 08 05:27 AM
Hiding a button when hiding rows fergusor Excel Discussion (Misc queries) 2 August 10th 06 02:31 PM
Hiding Column Also hiding text Cindy Excel Programming 0 April 6th 06 07:18 PM
hiding a file lpeterson Excel Worksheet Functions 6 December 29th 04 10:53 PM
Hiding sheets in Excel Edward[_5_] Excel Programming 0 September 19th 03 12:08 PM


All times are GMT +1. The time now is 09:11 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"