When you install Dropbox, it generates a folder path that incorporates your Windows username. So on my main computer, the path is:
C:\Users\peter\Dropbox\files\
but on my secondary computer (different Windows username but access to the SAME dropbox folder), it's:
C:\Users\david\Dropbox\files\
I use this VBA code at the top of one of my macros:
But the problem is that I can't run this macro from my secondary ('david') computer, because the Dropbox file path is fixed/absolute and thus is not recognized from that computer...how can I edit the code so that it uses the correct Dropbox file path regardless of what computer I'm accessing it from?
I thought I'd found a relevant thread, but my attempt to port the advice, and change the 3rd line of code above to:
did not work...
C:\Users\peter\Dropbox\files\
but on my secondary computer (different Windows username but access to the SAME dropbox folder), it's:
C:\Users\david\Dropbox\files\
I use this VBA code at the top of one of my macros:
Code:
Dim MyPath As String
Dim MyFileName As String
MyPath = "C:\Users\peter\Dropbox\files\"
MyFileName = "data_file.csv
But the problem is that I can't run this macro from my secondary ('david') computer, because the Dropbox file path is fixed/absolute and thus is not recognized from that computer...how can I edit the code so that it uses the correct Dropbox file path regardless of what computer I'm accessing it from?
I thought I'd found a relevant thread, but my attempt to port the advice, and change the 3rd line of code above to:
Code:
MyPath = "C:\Users\" & Environ("USERPROFILE") & "\Dropbox\files\"