I have a macro on one computer where I changed the user name from
"C:\Users\" & Environ("Username") & "\
the macro ran without problem
I have now tried to run the macro on another computer but it does not work and the Msg box pops up.
Dim xlsmWB As String
xlsmWB = "C:\Users\" & Environ("Username") & "\Dropbox\Centa\xxx.xlsx"
If Dir(xlsmWB) = "" Then
'File not found on expected path / users machine handle error
MsgBox "You machine is not properly configured to run this code", vbCritical, "Error"
Workbooks.Open Filename:=xlsmWB, UpdateLinks:=0
I am running Office 2007 enterprise on both computers. Both files are in Dropbox, where the macro is in the first file and it should copy a worksheet from the first file to the second. Therefore I can open the first file from different computers but the macro has a problem with the path to the second file as each computer has a different administrator name.
Do you have any ideas what the problem could be?