On my work PC, I have no write on system drive (c).
So, I have used properties of desktop folder and changed location of it to another drive (d).
From windows 10, I am using my desktop from that drive (d) similarly as it was on drive (c).
Problem: I tried this vba code to open workbook on my desktop
Dim wb1 As Workbook: Set wb1 = Workbooks.Open(Environ("USERPROFILE") & "\Desktop\Query1.xls")
,but I got this error
Run-time error 1004:Sorry, we couldn't find C:\Users\Waleed\Desktop\Query1.xls. Is it possible it was moved, renamed or deleted?
I am asking this question, as I use excel files on my work pc and my laptop (no restriction) interchangeably
And it is hard to change my vba codes every time I change my machine.
As always , thanks for any help.