I've got a strange situation, and hopefully someone can shed some light on it. In my company, we're working with a Citrix VDI environment, meaning every user has identical software. For some reason on an Excel Workbook, a macro fails at 1 person, while it does work for all others who use this workbook (~10 users). He is new, so his user profile can't be corrupted already and his profile has also been reset afterwards.
After investigation, the code fails on a Workbooks.Open line. But when I debug the code, stepping through each line, the code does work. So there's no error in the data, it's all there.
Finally I figured out, that the issue was caused by the line above this line. I copy a range, then open another workbook and then paste that range there. If I do it the other way around, so first open the other workbook, switch back to the original workbook and then copy the range, the code works (see below).
How can it be, that this works for everybody but one? Especially since everybody has the same software/rights.
Old code:
Range("Input").Copy
Dim oNewFile As Workbook
Set oNewFile = Application.Workbooks.Open(sNewFile, , True)
oNewFile.Activate
Sheets("Input").Range("A4").PasteSpecial Paste:=xlPasteValues
New code:
Dim oNewFile As Workbook
Set oNewFile = Application.Workbooks.Open(sNewFile , , True)
ThisWorkbook.Activate
Range("Input").Copy
oNewFile.Activate
Sheets("Input").Range("A4").PasteSpecial Paste:=xlPasteValues
EDIT: The error message is this: