Copy cell data to web page fields

Vinith

New Member
Joined
May 28, 2015
Messages
1
Hi

Please need a assistance from some one.

My Goal: To copy cells from my excel sheet to input fields on a already opened webpage (in order to simplify the process). I need this basically to fill out my timesheet for work.
I found code which logs into www.gmail .com successfully, however I was not able to modify it to work with my webpage I need it for.
Here is the google code that currently functions well on my computer and with excel 2010:


Sub Test()
Const cURL = "https://accounts.google.com/ServiceLogin?service=mail&continue=https://mail.google.com/mail/" 'Enter the web address here
Const cUsername = "XXXXXX" 'Enter your user name here
Const cPassword = "XXXXXX" 'Enter your Password here
Dim IE As InternetExplorer
Dim doc As HTMLDocument
Dim LoginForm As HTMLFormElement
Dim UserNameInputBox As HTMLInputElement
Dim PasswordInputBox As HTMLInputElement
Dim SignInButton As HTMLInputButtonElement
Dim HTMLelement As IHTMLElement
Dim qt As QueryTable
Set IE = New InternetExplorer
IE.Visible = True
IE.Navigate cURL
'Wait for initial page to load
Do While IE.ReadyState <> READYSTATE_COMPLETE Or IE.Busy: DoEvents: Loop
Set doc = IE.Document
'Get the only form on the page
Set LoginForm = doc.forms(0)
'Get the User Name textbox and populate it
'input name="Email" id="Email" size="18" value="" class="gaia le val" type="text"
Set UserNameInputBox = LoginForm.elements("Email")
UserNameInputBox.Value = cUsername
'Get the password textbox and populate it
'input name="Passwd" id="Passwd" size="18" class="gaia le val" type="password"
Set PasswordInputBox = LoginForm.elements("Passwd")
PasswordInputBox.Value = cPassword
'Get the form input button and click it
'input class="gaia le button" name="signIn" id="signIn" value="Sign in" type="submit"
Set SignInButton = LoginForm.elements("signIn")
SignInButton.Click
'Wait for the new page to load
Do While IE.ReadyState <> READYSTATE_COMPLETE Or IE.Busy: DoEvents: Loop
End Sub


The modifications I would like to make to the above code is the following:

1) instead of using "Const cUsername = "XXXXXX"", I would like to transfer the numbers in a cell in excel. So for example in my excel file, cell A1 = "myproject", I want this text/number "myproject" to appear in the first field in the HTML site.
2) Instead of loading a new page, I would like to run the macro on a already opened page (see the html code below) with the fields ready to be typed in.

I hope someone can help with this,
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"

Forum statistics

Threads
1,214,787
Messages
6,121,561
Members
449,038
Latest member
Guest1337

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
Back
Top