Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to check output folder has been created in the network path?using VBA programming

On a spreadsheet a button "Check Status" is added
Pressing the button will trigger a simple check as to whether the output folder has been created in the network path.
- If that folder does not exist, a reply "In progress" or similar appears.
- If that folder exists, a hyperlink to the folder's network path appears; clicking the link will open a browser to that location,

Please put some light on this problem to solve.

Thanks
Harinath



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 93
Default How to check output folder has been created in the network path?using VBA programming

Put this line in the Declaration section

Declare Function MakeSureDirectoryPathExists Lib "imagehlp.dll" (ByVal lpPath As String) As Lon

call this sub with the name of your output folder

sub aa(byval outputfolder
MakeSureDirectoryPathExists outputfolde
end su

The output folder will be created if it does not exist.
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default How to check output folder has been created in the network path?using VBA programming

Thanks for the info

But in my case the code should check that the folder is created in the path (or like presence of the folder in the network path)
It should not create the folder

If the folder exists a popup message should provide a path,by clicking that the path the browser should open

thank
harinath
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 93
Default How to check output folder has been created in the network path?using VBA programming

This API returns 0 is a folder does not exist and non zero when it does

Declare Function PathFileExists Lib "shlwapi.dll" Alias "PathFileExistsA" (ByVal pszPath As String) As Long
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default How to check output folder has been created in the network path?using VBA programming

No it doesn't, it returns 0 if it fails, that is it doesn't create one or
more folders, 1 if all is well.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"AA2e72E" wrote in message
...
This API returns 0 is a folder does not exist and non zero when it does.

Declare Function PathFileExists Lib "shlwapi.dll" Alias "PathFileExistsA"

(ByVal pszPath As String) As Long




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default How to check output folder has been created in the network path?using VBA programming

Two things.

The directory name must end with a \.

If you want to know whether it existed before the code was executed use
something like

Dim sFolder As String
Dim sDir As String
Dim ans
sFolder = "C:\myDir"
On Error Resume Next
sDir = Dir(sFolder, vbDirectory)
If sDir = "" Then
If (GetAttr(sFolder) And vbDirectory) = vbDirectory Then
MakeSureDirectoryPathExists sFolder & "\"
End If
End If


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"AA2e72E" wrote in message
...
Put this line in the Declaration section:

Declare Function MakeSureDirectoryPathExists Lib "imagehlp.dll" (ByVal

lpPath As String) As Long

call this sub with the name of your output folder.

sub aa(byval outputfolder)
MakeSureDirectoryPathExists outputfolder
end sub

The output folder will be created if it does not exist.



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
Path to a network drive CWillis Excel Discussion (Misc queries) 2 June 23rd 06 03:06 AM
Get output Path annapuvat Excel Programming 9 February 29th 04 02:06 PM
Diff. btw Open [path] For OUTPUT vs. For INPUT XLDweeb Excel Programming 0 November 18th 03 11:14 AM
Saving to a Network Path using VBA Mike R Excel Programming 1 August 11th 03 10:34 AM
Network Path Karen[_5_] Excel Programming 2 August 5th 03 12:05 PM


All times are GMT +1. The time now is 05:08 PM.

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"