There are many questions like this one on the internet, but none of them has led me to a solution. Hopefully, I can find some relief here.
I have a community of users who are currently going through a migration from Windows 7 to Windows 10, and along with it, a migration from Office 2010 to Office 365. As a result of this migration, SOME (not all) of my users have begun to experience an issue with a macro that worked fine in Win7/Excel 2010, but now throws an error in Win10/Excel365. The specific line of code that is failing is an application.saveas statement:
ActiveWorkbook.SaveAs FileName:=myFileName, FileFormat:=xlOpenXMLWorkbookMacroEnabled
I have tested and/or checked the following:
That the entire path name is correct, ie there are no unexpected characters in it, it points to a valid networked location, nothing is misspelled, etc. This is definitely not the problem. Also, the path being used is a fully qualified network path (using the computer name itself, not a letter drive). AND, the users having trouble get no relief when I switch the path to C:\Users<username>\filename
Swapping out
FileFormat:=xlOpenXMLWorkbookMacroEnabled
withFileFormat:=52
;; No diceSwapping out the entire line of code for a SaveAs dialog box that is properly filled in. The same error is produced at the Execute command. Code below:
With Application.FileDialog(msoFileDialogSaveAs) .AllowMultiSelect = False .FilterIndex = 2 '2 = xlsm .InitialFileName = myFileName .InitialView = msoFileDialogViewDetails If .Show = -1 Then strFolder = .SelectedItems(1) Else Exit Sub .Execute ''''Run time error 10004005 "Document not saved" error happens here End With
Checked a user's add-ins; nothing of interest was found here. They had different add-ins than me, but I had them disable ALL add-ins and this still didn't work
Went through a user's entire trust center and lined it up as best I could with my own (my machine works fine). We found one setting that we though was worth changing, but it had no effect
I am ensured that the users who have experienced the problem so far have (like me) received fully new computers with the new OS/Office version installed clean. So I have ruled this out as the cause.
I have run the macro successfully with graphics acceleration turned off and turned on, thus ruling out that issue (this was causing other Excel problems when I first upgraded).
Any thoughts from the community on what else I might consider or try would be appreciated as I am totally stumped at this point on what to try next.
Thanks!