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.
Sandesh555Asked:
Who is Participating?
 
royhsiaoConnect With a Mentor Commented:
You could try programs like autofill in mozilla or in Chrome.
https://addons.mozilla.org/en-US/firefox/addon/autofill-forms/
http://www.google.com/support/chrome/bin/answer.py?answer=142893

or

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.
http://www.dailydoseofexcel.com/archives/2004/12/02/putting-text-into-the-windows-clipboard/
http://www.cpearson.com/excel/clipboard.aspx


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

End Sub

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

End Sub

Open in new window

0
 
royhsiaoCommented:
Hi,

First of all try to write the following code to open the IE from excel.
Check the following post for detail:
http://www.codeforexcelandoutlook.com/excel-vba/automate-internet-explorer/
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:
http://www.ozgrid.com/forum/showthread.php?t=80955

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

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

Set appIE = CreateObject("InternetExplorer.Application")

sURL = "http://www.google.com" 

With appIE
    .Navigate sURL
    .Visible = True
End With

Application.ScreenUpdating = True

Set appIE = Nothing
End Sub

Open in new window

0
 
Sandesh555Author Commented:
Hi,

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.
0
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.