Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Directory Code to access files is not working?

Status
Not open for further replies.

tekvb1977

Technical User
Nov 16, 2005
46
US
The code below is driving me nuts. It's a simple and used to work on my machine but now all of a suddent it's not working properly:

Dim strFolderName As String

strFolderName = Dir$("G:\QuoteSheets\*QuoteSheet*")

If strFolderName = "" Then
Exit Function
End If

My directory ("G:\QuoteSheets\*QuoteSheet*")is not empty. It has two excel files in it. But when i try to run the code it exits the function becasue it detects that strFolderName = ""


Any ideas why this is happening.

Thanks a lot in advance.

J
 
try

strFolderName = Dir$("G:\QuoteSheets\*QuoteSheet*",vbDirectory)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top