Question:
ERROR in filename = Dir(pathname & "*.xlsx") VBA statement?
Omkar Singh
2016-06-09 03:53:25 UTC
dir function doesn't return any value
error " Run time error '52': Bad filename or number" occur
Three answers:
BT_Bot
2016-06-09 08:55:45 UTC
Based on your comment to Chris' answer, you have a problem in pathname, It should probably be only ActiveWorkbook.Path or "D:\dropbox..." not both together.



To verify/debug place a Msgbox command right after assigning a value to pathname:

Msgbox(pathname)
?
2016-06-09 04:11:49 UTC
What's "pathname" set to? Does it end in a \ ?
?
2016-06-09 08:52:57 UTC
check for space or caps in the file name


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...