VBA to Log into Googles DropBox and submit Files

dvolsche

New Member
Joined
Dec 18, 2016
Messages
1
Hi every one, I'm hoping someone on here can help me.

I'm using an online google site that allows you to upload files, which are linked to Dropbox, which is then linked to my google drive, allowing direct uploads to my google drive if you have the website address
I'm familiar with vba's but i'm completely lost with this. I'm hoping to have a vba which will select the "choose file button", past a predetermined path or file name into the pop up browse window and then have the vba hit enter, and proceed to click the submit button. Is this possible ?

Below is my current code as well as the website address. As you'll see the website is super-basic so it should be to hard right ? Im lost any insight would be great.

Dim HTMLDoc As HTMLDocument
Dim MyBrowser As InternetExplorer


Sub Upload()


Dim MyHTML_Element As IHTMLElement
Dim MyURL As String
On Error GoTo Err_Clear
MyURL = "https://script.google.com/macros/s/AKfycbznalI3P2XuT5PubzdP7XJ_6X3tneK4Xjhlss_RVum-eCeJUkU/exec"
Set MyBrowser = New InternetExplorer
MyBrowser.Silent = True
MyBrowser.navigate MyURL
MyBrowser.Visible = True
Application.Wait Now() + TimeValue("00:00:05")
Do
Loop Until MyBrowser.readyState = READYSTATE_COMPLETE
Set HTMLDoc = MyBrowser.document

HTMLDoc.all.myName.Value = "NAME" 'Name here
For Each MyHTML_Element In HTMLDoc.getElementsByTagName("input")
If MyHTML_Element.Type = "Submit" Then MyHTML_Element.Click: Exit For
Next


Err_Clear:
If Err <> 0 Then
Err.Clear
Resume Next
End If
End Sub



Below is the link to the site
https://script.google.com/macros/s/AKfycbznalI3P2XuT5PubzdP7XJ_6X3tneK4Xjhlss_RVum-eCeJUkU/exec
 

Some videos you may like

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.

Kyle123

Well-known Member
Joined
Jan 24, 2012
Messages
2,708
You can't do it like this. You cannot upload files using Internet Explorer automation - it's a security feature of IE, you cannot automate the File input type.

You'll need to look for another solution, though it's not likely to be simple
 

John_w

MrExcel MVP
Joined
Oct 15, 2007
Messages
6,619
You can emulate a file upload HTML form with < input type=file> by sending a multipart/form-data POST request - see Automated file upload using IE, without user interaction - VBA. The example uses IE, and you can also use XMLhttp or WinHttpRequest.

You can upload files to Google Drive using the Drive API - https://developers.google.com/drive/v3/web/manage-uploads - however it is very complicated. You have to enable the Drive API in the Google API Console and register your application (VBA program). The VBA program must also authorise the requests - https://developers.google.com/drive/v3/web/about-auth.
 
Last edited:

Watch MrExcel Video

Forum statistics

Threads
1,122,804
Messages
5,598,168
Members
414,215
Latest member
SRGDZMCS

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top