Dropbox for Teams are doing an upgrade on December 10, 2022
As part of the upgrade, the directory of Dropbox will be changed from Dropbox (me) to me (Dropbox).
This is part of the email we received.
The Dropbox folder name will change from “Dropbox [team name]” to “[Team name] Dropbox.” You may need to modify any third-party automation file paths that are using the old Dropbox folder name for them to work properly after the upgrade.
At the moment we hard-code the dropbox file path in our VBA code
fromPath = "C:\Dropbox (me)\Development\" aDir "\"
Is there are a way of replacing this with code that will work both before and after the change.
For instance
fromPath = getDropBoxPath() "\Development\" aDir "\"
CodePudding user response:
The following code will do what I want. It is based upon @Reinaldo's answer in How do I programmatically locate my Dropbox folder using C#?.
Function getDropboxPath()
jsonPath = Environ$("LocalAppData") "\Dropbox\info.json"
Open jsonPath For Input As #1
Input #1, firstLine
aSplit = Split(firstLine, Chr(34) "path" Chr(34) ":")
Close #1
getDropboxPath = aSplit(1)
End Function
I know the code can be improved but this is probably enough for me at the moment.
It uses the info.json
file provided by dropbox and relies on the first line of the .json file being something like this.
{"business": {"path": "C:\\Dropbox (me)"