cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Re: load files whit excel vba

load files whit excel vba

smarta1
Explorer | Level 3

Hi.

I would like to receive an example on how to upload a file (ie *.xlsm) to dropbox from excel using vba.

Thanks a lot.

6 Replies 6

Jay
Dropbox Staff

Hi @smarta1, thanks for posting on the Community!

 

Are you trying to upload files to Dropbox directly using the Excel app, or via Office Online?

 

Keep me posted!


Jay
Community Moderator @ Dropbox
dropbox.com/support


Heart Did this post help you? If so, give it a Like below to let us know.
:arrows_counterclockwise: Need help with something else? Ask me a question!
:pushpin: Find Tips & Tricks Discover more ways to use Dropbox here!
:arrows_counterclockwise: Interested in Community Groups? Click here to join!

smarta1
Explorer | Level 3

Hi Jay.

Thanks for your answer.

I am using MS Excel (Microsoft Office) on a Desktop with Windows 8.1 (No Office Online).

I would like to have a VBA routine to insert in my excel file (*.xlsm).

Best regards.

Jay
Dropbox Staff

I'm not sure if it's possible to create a VBA script to upload to Dropbox directly, however, you can look into the Dropbox API documentation for more information to see if there is any possibility of doing so using the info there.


Jay
Community Moderator @ Dropbox
dropbox.com/support


Heart Did this post help you? If so, give it a Like below to let us know.
:arrows_counterclockwise: Need help with something else? Ask me a question!
:pushpin: Find Tips & Tricks Discover more ways to use Dropbox here!
:arrows_counterclockwise: Interested in Community Groups? Click here to join!

smarta1
Explorer | Level 3

Hi Jay.

I asked because I found the following but I do not know if is complete:

Public Sub DB_PutFile(FileName As String)

Dim req As MSXML2.ServerXMLHTTP60

Dim strFile As String

Dim Pos1 As Integer

Dim Pos2 As Integer

Dim arg As String

    Set req = New MSXML2.ServerXMLHTTP60

    strFile= ReadBinary(FileName)

    arg = "{""path"":""/" & FileName & """,""mode"":{"".tag"":""overwrite""},""autorename"":false,""mute"":true}"

    req.Open "POST", "https://content.dropboxapi.com/2/files/upload", False

    req.setRequestHeader "Authorization", "Bearer xxxxxxxxxxxxxxxx"

    req.setRequestHeader "Content-Type", "application/octet-stream"

    req.setRequestHeader "Content-length", Len(Result)

    req.setRequestHeader "Dropbox-API-Arg", arg

    req.setRequestHeader "User-Agent", "api-explorer-client"

    req.send strFile

    If req.Status = 200 Then

        Debug.Print req.responseText

    Else

'MsgBox req.Status & ": " & req.statusText

        Debug.Print req.responseText

    End If

End Sub

Can you help me?

Best regards.

Jay
Dropbox Staff

It does look like some API calls are made there. I can move this thread to the API forum, however, bear in mind that we might not be able to assist with the VBA script as it isn't related to Dropbox itself.


Jay
Community Moderator @ Dropbox
dropbox.com/support


Heart Did this post help you? If so, give it a Like below to let us know.
:arrows_counterclockwise: Need help with something else? Ask me a question!
:pushpin: Find Tips & Tricks Discover more ways to use Dropbox here!
:arrows_counterclockwise: Interested in Community Groups? Click here to join!

Greg-DB
Dropbox Staff

@smarta1 The Dropbox API does offer the ability to programmatically upload files, such as by using /2/files/upload as referenced in the code you shared. Please refer to the documentation linked there for information on using that.

 

Give that a try and if something on the API isn't working expected, please share the error/output.

Need more support?