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

Posted on 2011-10-30
Last Modified: 2013-11-29
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.
Question by:Sandesh555
    LVL 6

    Expert Comment


    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


    Author Comment


    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.
    LVL 6

    Accepted Solution

    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


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Too many email signature updates to deal with?

    Are you constantly visiting users’ desks making changes to email signatures? Feel like it’s taking up all of your time? Wish you could manage all signatures from one central location, easily design them and deploy them quickly to users? Well, there is an easy way!

    Suggested Solutions

    Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
    Envision that you are chipping away at another e-business site with a team of pundit developers and designers. Everything seems, by all accounts, to be going easily.
    The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
    The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    9 Experts available now in Live!

    Get 1:1 Help Now