Run Excel Macro's using Shortcut Keys assigned in Internet Explorer.

Hi Team,

I would like to run some excel macros, the triger for these excel macro should be shortcut keys in Internet explorer.

To give you the background of why I need this.  I have some online user forms that I want to fill up.  The data for this is available in Excel file.   So when the user clicks any of the short keys, I should be able to fire up excel macros assigned to it.  This way the data needed gets copied from Excel to the acitve text box the user has selected.
Who is Participating?
royhsiaoConnect With a Mentor Commented:
You could try programs like autofill in mozilla or in Chrome.


you can use macro to open the site and copy the data from excel and save the data in the clipboard. Let use click the "control+V" to paste the data.
Here is an example.

Sub Copy_Click()
Dim DataObj As New MSForms.DataObject
    Dim S As String
    S = "Hello World"
    DataObj.SetText S

End Sub

Sub Paste_Click()
    Dim DataObj As New MSForms.DataObject
    Dim S As String
    S = DataObj.GetText
    MsgBox S

End Sub

Open in new window


First of all try to write the following code to open the IE from excel.
Check the following post for detail:
Second, open the site and click "view source"
Third, find the path that will lead to the cells. This will be like trail and error things so you will need to try the path until you find the right one.
Check the following pst about auto log in:

The basic format is the following:
    ie.Document.forms(0).all("Email").Value = "yourvalue here"
    ie.Document.forms(0).all("Passwd").Value = "yourvaluehere"
However, it will change depend on the site.

Sub GoToWebSite()
Dim appIE As Object ' InternetExplorer
Dim sURL As String
Application.ScreenUpdating = False

Set appIE = CreateObject("InternetExplorer.Application")

sURL = "" 

With appIE
    .Navigate sURL
    .Visible = True
End With

Application.ScreenUpdating = True

Set appIE = Nothing
End Sub

Open in new window

Sandesh555Author Commented:

Thanks for your post.  The code given above is definetly relavent.  But you see, I have close to 3,000 to 5,000 websites for which I will have to figure out this details.

That was the reason why I was thinking of assigning shortcut keys of Internet Explorer that will run my excel Macros.  

For example.  I will have one macro for entring password and another one for entring username.  Now the user has to select the text box for user name and run the Username shortcut key in Internet Explorer.  That will in turn run the excel part of Username Macro.  Which will just copy it from excel and paste the same in the active text box selected.

Please note the number of feilds that I have to select and fill is close to 7 for each of these websites.

If you have a better solution, I am ok with that also.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.