![]() |
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 |
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. |
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 |
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. |
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 |
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 |
All times are GMT +1. The time now is 04:37 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com