?
Solved

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

Posted on 2011-10-30
3
Medium Priority
?
894 Views
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.
0
Comment
Question by:Sandesh555
  • 2
3 Comments
 
LVL 6

Expert Comment

by:royhsiao
ID: 37054036
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
 

Author Comment

by:Sandesh555
ID: 37055120
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
 
LVL 6

Accepted Solution

by:
royhsiao earned 2000 total points
ID: 37057184
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

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Dramatic changes are revolutionizing how we build and use technology. Every company is automating, digitizing, and modernizing operations. We need a better, more connected way to work together as teams so we can harness the insights from our system…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

809 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