Find Your Dropbox Folder in VBA

Here’s a function to get the location of the Dropbox folder:

According to Reinaldo there is a host.db file in the Roaming directory that stores this information. The Environ("appdata") function returns the Roaming directory in Win7. I open host.db and read in the text. Then I create a new XML document, thanks to Tim Hastings, to write in the Base64 text and read out the byte data that is converted to Unicode. There’s two lines in my host.db file, so I split on vbLf and only use the second line.

Here’s what it would look like if I wrote this function and didn’t want to poke my eyes out afterward.

5 thoughts on “Find Your Dropbox Folder in VBA

  1. another anti poking measure:

    Sub M_snb()
    With CreateObject("Msxml2.DOMDocument.6.0")
    With .createElement("b")
    .DataType = "bin.base64"
    .Text = Split(CreateObject("scripting.filesystemobject").opentextfile(Environ("appdata") & "\DropBox\host.db").readall, vbLf)(1)
    MsgBox StrConv(.nodeTypedValue, 64)
    End With
    End With
    End Sub

  2. Update: The host.db has been removed by DropBox. The new file is info.json

  3. Thanks Lawrence. I’ve never used MS ScriptControl 1.0 before and this was a good opportunity to do so.

  4. Updated Sep 2019:
    It’s in

    {“personal”: {“path”: “C:\\Path to my\\Documents\\Dropbox”, “host”: 1234567890 “is_team”: false, “subscription_type”: “Basic”}}

    Open VBA.Interaction.Environ(“USERPROFILE”) & “\AppData\Local\Dropbox\info.json” For Input As #intFile

    and parse it any way you like. Code in SO link:

    Thanks to

Posting code? Use <pre> tags for VBA and <code> tags for inline.

Leave a Reply

Your email address will not be published.