By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,984 Members | 1,016 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,984 IT Pros & Developers. It's quick & easy.

Run-time Error 52, Bad file name or number

P: 1
Problem with Excel Macro contacting a SharePoint folder in Windows 10.
I have a model that has been running under Windows 7 for several years without a problem. When i migrated to Windows 10 the part of the macro that is looking for a folder on SharePoint no longer works. I have tried the same macro but referencing a local file on my laptop and there is no problem.
When I ran the debug it highlights the line for:

If Len (Dir(vSource & vFile) ) = 0 Then


Attached Images
File Type: png Macroserror.PNG (159.6 KB, 190 views)
4 Weeks Ago #1
Share this Question
Share on Google+
5 Replies


Expert 100+
P: 1,032
Your replaced your system (from Windows7 to Windows 10), you did not change anything to the macro in Excel, and it gives an error.

Option 1: You have not enough right (under windows 10) to access this SharePoint folder.

Option 2: Something is missing to your installation of Excel under Windows 10.

For this to solve more info is needed than a picture and the description you gave in the subject of this message.

What values do the variables 'vSource' and 'vFile' have? Do they point to a correct destination in SharePoint?

When reading Error 52 on the site of Microsoft, its unclear if this is related to your problem.
4 Weeks Ago #2

zmbd
Expert Mod 5K+
P: 5,387
Luuk, your link points to the system level error
This is the link to
VBA Runtime Error 52

What values do the variables 'vSource' and 'vFile' have? Do they point to a correct destination in SharePoint?
Exactly, this is your first trouble shooting step.
Place a few Debug.print and <ctrl><g> to see how these two strings are resolving.
4 Weeks Ago #3

Expert 100+
P: 1,032
@zmdb: I was 'as-lazy-as' @adanvilla10,
and did stop reading after 'Error 52'

The text after this 'Bad file name or number' would (or should) have made bells ringing.

@adanvilla10: Happy debugging!
4 Weeks Ago #4

zmbd
Expert Mod 5K+
P: 5,387
mea-culpa : We stand among great friends : Happens even to the best of us, look back thru my posts thru the years (how did that happen?!), Neopa, Rabbit, and I think even you have fixed many of my oversights :)
4 Weeks Ago #5

NeoPa
Expert Mod 15k+
P: 31,347
That's some code with a lot of problems. Forget the logic. It's a mess.

Check out Before Posting (VBA or SQL) Code. Oh, and always post the code in text as a picture is as close to useless as you ever want to get.

PS. Well done Zmbd, but don't sweat it Luuk. As Z says - we all make mistakes from time to time.
4 Weeks Ago #6

Post your reply

Sign in to post your reply or Sign up for a free account.