1

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:

enter image description here

4
  • What are the error messages? Commented Jun 20, 2022 at 5:57
  • Not directly relevant to your question but you should read on how to avoid using Select, using select/activate is a very bad practice and it is also prone to error. Commented Jun 20, 2022 at 6:05
  • You shouldn't use implcit references ... better use ThisWorkbook.Range("Input").copy Commented Jun 20, 2022 at 10:55
  • Thanks for the advice, I will try to make this a common practice. I wasn't able to test this though. But it's still strange that it only fails for 1 person. Commented Jun 21, 2022 at 7:58

1 Answer 1

0

We found solution when we met similar issue. VDI machine had different local settings. As a result we had different delimitators ";" vs "," in formulas and "." vs "," in numbers. Decision - change (align) local settings in local and VDI machine

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.