Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Passing Data to Internet Browser
I'm trying to write code that will assign data in 3 cells to 3 variables,
i.e. - strVIN = activecell.offset(0,-3).value strDate = activecell.offset(0,-2).value strName = activecell.offset(0,-1).value Then, I want to open an Internet Browser window (user's default browser), navigate to a specific website (I have this part down), and then place the values of my 3 variables into 3 text boxes on the website. I tried SendKeys using the Tab key and then the variables. Problem with this is the timing of the action. If the browser window doesn't open soon enough, the data is pasted in the active cell in Excel. How can I consistently paste the information in the proper browser locations every time? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Passing Data to Internet Browser
Well you can't with the way your going about it Excell VBA can interface with
some windows applications but I don't think that it was ment to the way your trying to do it seem's like the hard way. I would suggest using VBS (Visual Basic Script) in conjunction with you Excell to accomplish this. Although if you are not firmilar with VBS this could poise a problem. Unfortuanitly I am not firmillar enough with VBS to show you how to do this with a code example. "SyrNO" wrote: I'm trying to write code that will assign data in 3 cells to 3 variables, i.e. - strVIN = activecell.offset(0,-3).value strDate = activecell.offset(0,-2).value strName = activecell.offset(0,-1).value Then, I want to open an Internet Browser window (user's default browser), navigate to a specific website (I have this part down), and then place the values of my 3 variables into 3 text boxes on the website. I tried SendKeys using the Tab key and then the variables. Problem with this is the timing of the action. If the browser window doesn't open soon enough, the data is pasted in the active cell in Excel. How can I consistently paste the information in the proper browser locations every time? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Passing Data to Internet Browser
I got it. Was checking out www.ozgrid.com and found the following bit of
code that basically says, "until the browser is ready, busy yourself". THEN, I am able to use SENDKEYS to move to the necessary textboxes and send the variable data. Set ie = CreateObject("InternetExplorer.Application") ie.navigate "https://www.anywhere.com" Do While ie.busy And Not ie.readystate = 4 DoEvents Loop ie.Visible = True works like a charm :-)) "SyrNO" wrote: I'm trying to write code that will assign data in 3 cells to 3 variables, i.e. - strVIN = activecell.offset(0,-3).value strDate = activecell.offset(0,-2).value strName = activecell.offset(0,-1).value Then, I want to open an Internet Browser window (user's default browser), navigate to a specific website (I have this part down), and then place the values of my 3 variables into 3 text boxes on the website. I tried SendKeys using the Tab key and then the variables. Problem with this is the timing of the action. If the browser window doesn't open soon enough, the data is pasted in the active cell in Excel. How can I consistently paste the information in the proper browser locations every time? |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Passing Data to Internet Browser
Hi SyrNO,
Could you post the full code? I am very interested in passing data to IE. Many thanks, Antonio "SyrNO" wrote: I got it. Was checking out www.ozgrid.com and found the following bit of code that basically says, "until the browser is ready, busy yourself". THEN, I am able to use SENDKEYS to move to the necessary textboxes and send the variable data. Set ie = CreateObject("InternetExplorer.Application") ie.navigate "https://www.anywhere.com" Do While ie.busy And Not ie.readystate = 4 DoEvents Loop ie.Visible = True works like a charm :-)) "SyrNO" wrote: I'm trying to write code that will assign data in 3 cells to 3 variables, i.e. - strVIN = activecell.offset(0,-3).value strDate = activecell.offset(0,-2).value strName = activecell.offset(0,-1).value Then, I want to open an Internet Browser window (user's default browser), navigate to a specific website (I have this part down), and then place the values of my 3 variables into 3 text boxes on the website. I tried SendKeys using the Tab key and then the variables. Problem with this is the timing of the action. If the browser window doesn't open soon enough, the data is pasted in the active cell in Excel. How can I consistently paste the information in the proper browser locations every time? |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Passing Data to Internet Browser
Not a problem, Antonio
Here's the setup: I work for a bank that receives a spreadsheet of Vehicle information including VIN, Year and Make of the vehicle. There's a website we have to go to and check for information about this vehicle. Instead of manually typing the information in (time consuming and potential typing errors), I was asked to design a macro that would open the site and populate the text fields with proper data. VIN information is Column A, Year is Column B and Make is Column C. Sub LookUpOnInternet() Dim VIN As String Dim CurrentRow As String Dim YR As Integer Dim MAKE As String Dim ie As Object CurrentRow = ActiveCell.Row VIN = Range("A" & CurrentRow).Value YR = Range("B" & CurrentRow).Value MAKE = Range("C" & CurrentRow).Value Set ie = CreateObject("InternetExplorer.Application") ie.navigate "https://corvus.dmv.state.ny.us/titlstat/iviqEnterVehInfo.cfm" Do While ie.busy And Not ie.readystate = 4 DoEvents Loop ie.Visible = True SendKeys "{TAB}", True SendKeys "{TAB}", True SendKeys VIN SendKeys "{TAB}", True SendKeys YR SendKeys "{tab}", True SendKeys MAKE End Sub "Antonio" wrote: Hi SyrNO, Could you post the full code? I am very interested in passing data to IE. Many thanks, Antonio "SyrNO" wrote: I got it. Was checking out www.ozgrid.com and found the following bit of code that basically says, "until the browser is ready, busy yourself". THEN, I am able to use SENDKEYS to move to the necessary textboxes and send the variable data. Set ie = CreateObject("InternetExplorer.Application") ie.navigate "https://www.anywhere.com" Do While ie.busy And Not ie.readystate = 4 DoEvents Loop ie.Visible = True works like a charm :-)) "SyrNO" wrote: I'm trying to write code that will assign data in 3 cells to 3 variables, i.e. - strVIN = activecell.offset(0,-3).value strDate = activecell.offset(0,-2).value strName = activecell.offset(0,-1).value Then, I want to open an Internet Browser window (user's default browser), navigate to a specific website (I have this part down), and then place the values of my 3 variables into 3 text boxes on the website. I tried SendKeys using the Tab key and then the variables. Problem with this is the timing of the action. If the browser window doesn't open soon enough, the data is pasted in the active cell in Excel. How can I consistently paste the information in the proper browser locations every time? |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Passing Data to Internet Browser
Yes, thank you very much. I was able to make it work myself in the same way.
The Do While ie.busy And Not ie.readystate = 4 DoEvents Loop is the interesting trick. It works really well and I will use it a lot. Regards, Antonio "SyrNO" wrote: Not a problem, Antonio Here's the setup: I work for a bank that receives a spreadsheet of Vehicle information including VIN, Year and Make of the vehicle. There's a website we have to go to and check for information about this vehicle. Instead of manually typing the information in (time consuming and potential typing errors), I was asked to design a macro that would open the site and populate the text fields with proper data. VIN information is Column A, Year is Column B and Make is Column C. Sub LookUpOnInternet() Dim VIN As String Dim CurrentRow As String Dim YR As Integer Dim MAKE As String Dim ie As Object CurrentRow = ActiveCell.Row VIN = Range("A" & CurrentRow).Value YR = Range("B" & CurrentRow).Value MAKE = Range("C" & CurrentRow).Value Set ie = CreateObject("InternetExplorer.Application") ie.navigate "https://corvus.dmv.state.ny.us/titlstat/iviqEnterVehInfo.cfm" Do While ie.busy And Not ie.readystate = 4 DoEvents Loop ie.Visible = True SendKeys "{TAB}", True SendKeys "{TAB}", True SendKeys VIN SendKeys "{TAB}", True SendKeys YR SendKeys "{tab}", True SendKeys MAKE End Sub "Antonio" wrote: Hi SyrNO, Could you post the full code? I am very interested in passing data to IE. Many thanks, Antonio "SyrNO" wrote: I got it. Was checking out www.ozgrid.com and found the following bit of code that basically says, "until the browser is ready, busy yourself". THEN, I am able to use SENDKEYS to move to the necessary textboxes and send the variable data. Set ie = CreateObject("InternetExplorer.Application") ie.navigate "https://www.anywhere.com" Do While ie.busy And Not ie.readystate = 4 DoEvents Loop ie.Visible = True works like a charm :-)) "SyrNO" wrote: I'm trying to write code that will assign data in 3 cells to 3 variables, i.e. - strVIN = activecell.offset(0,-3).value strDate = activecell.offset(0,-2).value strName = activecell.offset(0,-1).value Then, I want to open an Internet Browser window (user's default browser), navigate to a specific website (I have this part down), and then place the values of my 3 variables into 3 text boxes on the website. I tried SendKeys using the Tab key and then the variables. Problem with this is the timing of the action. If the browser window doesn't open soon enough, the data is pasted in the active cell in Excel. How can I consistently paste the information in the proper browser locations every time? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Send Key to open a particular internet browser | Excel Worksheet Functions | |||
Close an Internet Explorer browser window | Excel Programming | |||
Excel macro error when opened in internet browser | Excel Programming | |||
Passing a dataset from jsp to browser excel plugin | Excel Programming |