Solved

VBA Check Folders

Posted on 2013-11-11
5
324 Views
Last Modified: 2013-11-11
Hello All,

Can anyone help with how to do this? This is in reference to the solution of this previous question -
http://www.experts-exchange.com/Programming/Languages/Visual_Basic/Q_28162861.html

How do i do this in VBA - so that first the code checks for the folder that exists. Then is continues the code that is after this checking.

All experts are welcome :)

Thanks
0
Comment
Question by:Rayne
  • 3
  • 2
5 Comments
 
LVL 10

Assisted Solution

by:broro183
broro183 earned 500 total points
ID: 39638363
hi Rayne,

I can't tell from the previous (linked) question which suggestion of Aikimark's you are using to refresh your drives.

I'm not sure if I fully understand this question so this comment may or may not provide an answer for you.

To check that a file or folder exists I normally use the below function. I can't remember if it works for files stored on SharePoint.

Public Function DoesFileFolderExist(strfullpath As String) As Boolean
'25/10/2010, RB: sourced from www.excelguru.ca/node/30 by Ken Puls
'note it only checks for the existence of the lowest folder (or the file) in the strfullpath string.
    On Error GoTo EarlyExit
    If Not Dir(strfullpath, vbDirectory) = vbNullString Then DoesFileFolderExist = True
EarlyExit:
    On Error GoTo 0
End Function

Open in new window


hth
Rob
0
 
LVL 10

Accepted Solution

by:
broro183 earned 500 total points
ID: 39638370
This can be implemented using something like:

if DoesFileFolderExist("change as required to the Folder name") then
'code if folder exists...
else
'folder doesn't exist therefore...
msgbox "Folder doesn't exist"
end if

Open in new window


hth
Rob
0
 

Author Comment

by:Rayne
ID: 39638377
AWESOME Rob,
This is exactly what I needed :)
Thank you...
0
 
LVL 10

Expert Comment

by:broro183
ID: 39638434
hi Rayne,

I'm pleased I could help - please let me know if it does work with Sharepoint locations.

Thanks for the points :-)
Rob
0
 

Author Comment

by:Rayne
ID: 39640631
Thank you Rob, I will check that  and let you know.
Meanwhile, here is a question if that interest you
http://www.experts-exchange.com/Software/Office_Productivity/Office_Suites/MS_Office/Q_28291518.html
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Oart.dll 2 28
Recurring Excel Timelime for Veeam 2 35
TT Copy Formula 3 16
Excel Difference between 2013 and 2016 2 12
PaperPort has a feature called the "Send To Bar". It provides a convenient, drag-and-drop interface for using other installed software, such as Microsoft Office. However, this article shows that the latest Office 2016 apps (installed with an Office …
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now