Automating an already open Internet explorer Window

ftv

Board Regular
Joined
Sep 27, 2010
Messages
74
Hey guys , i need a little assistance trying to figure out how i can run a code in an already existing internet explorer window

ive seen several codes but i cant seem to get them to work. im using 2003


the code i have seen is but i just cant get anything to work
For Each ie As InternetExplorer In New ShellWindows
If ie.LocationURL = www.google.com Then
ie.Navigate ("www.google.com")
MessageBox.Show (ie.Path.ToString)
End If


after i complete that task ,i need to next figure out how to fill in a form with a single cell from my spreadsheet
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
You need to find out what the textboxes on the form are called and set their values using the appropriate values in the worksheet.

As an example, if you'd managed to find your way to the Yahoo login page, you would enter your username and password and press the Sign In button like this:-
Code:
  With objIE.document
    .all.login.Value = "ruddles"
    .all.passwd.Value = "secret"
    .forms(0).submit
  End With
You may need to deconstruct the page's HTML to find out what the textboxes and command button are called.
 
Upvote 0
but how do i use an already open internet explorer window, i have about 6 open and need it to choose the one i want
 
Upvote 0
No idea. Can you not open the page in VBA? You could control it from there.
 
Upvote 0
I think i actually figured it out, now i need help with actually filling in the text box in ie i cant find a code that works. i look at the source code and this is the source code for the box i want to fill data in, also i want to fill info from cell a3 into the form


</span>
<span class="columnCenter">
<TEXTAREA name="comments"
cols="125"
class="form_comments"
style="display:block;"
id="textfield_Comments"></TEXTAREA>
<div class="form_comments"
style="display:none;"
readOnly
cols="125"
id="textfield_AutoDoc">
 
Upvote 0
Here is my code so far, i just cant get it to paste into internet explorer


Sub pasteintoie()
'
' pasteintoie Macro
' Macro recorded 5/19/2011 by vlomba1

Dim IE As Object
Dim ipf

With CreateObject("Shell.Application").Windows

If .Count > 0 Then
' Get IE
Set IE = .Item(0) ' or .Item(.Count - 1)
Else
' Create IE
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
End If

IE.Navigate "MY website"

End With

With IeApp.Document.forms("Comment")
ipf.Value = Range("A3") 'fill in the text box

End With

End Sub
 
Upvote 0
Can you show us the HTML of the form which contains the textbox?

Make sure you post inside HTML tags and insert a space after every < character otherwise the forum software has problems formatting the display.
 
Upvote 0
The HTML will help but the URL for the site/page of interest would be better.

For one thing, the HTML probably won't post properly on the board.
 
Upvote 0
This is the source code of the text area ..
HTML:
< span class="columnCenter" >
    < TEXTAREA name="comments"
      cols="125"
      class="form_comments"
      style="display:block;"
      id="textfield_Comments" >< /TEXTAREA>
    < div class="form_comments"
      style="display:none;"
      readOnly
      cols="125"
      id="textfield_AutoDoc" >

And this is the source code of a web based tool i have to essentially does the same thing but doesnt take data from excel.
HTML:
function ViewSolutionToolbarClick(button){
 
    if(button=='print'){
     docContent.focus();
  docContent.print();
    }
    if(button=='addtofavorites'){
        AddSolution();
    }
 if(button=='edit'){
     ******************.href = "request.do?session=8c49-11e0-752c-000000000000}&event=1&view()=ecb7-000000000000}&forward=edit-content"
    }
 if(button=='autoDoc'){
  if(autoDocText==""){
   //modifed on 11/25 bug 321 alert('Please select text to copy to Comment.');
   alert('Unable to copy to Program, you did not select any text.');
  }else{
 
   //insert opener js function call here
 
   if(opener){
    ProgramResponse = opener.addKMComments("[" + document.addSolsForm.Title.value +"] - "+ autoDocText);
    if(ProgramResponse!="ok"){
     alert(ProgramResponse);
    }else{
     //do this if update is successful
     opener.focus();
    }
   }else{
    alert("Unable to communicate with Program");
   }
   autoDocText =""
  }
 }
}

I cant give the website out unfortunetly
 
Upvote 0

Forum statistics

Threads
1,224,616
Messages
6,179,911
Members
452,949
Latest member
beartooth91

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top