VBA Macro For Already Open IE Window

RL101

New Member
Joined
May 29, 2011
Messages
1
Hi all,

I'm looking to create a VBA macro which will be ran from Excel (2003 or 2010) & which works with Internet Explorer. I have added 'Microsoft Internet Controls' to VBA References, and have looked at plenty of VBA code on the forum which opens & then navigates to specific websites.

However, what I need is for this macro to affect an already open IE window.

Does anyone have an idea of the syntax / command to have excel "select" a specific IE window already open?

Many thanks!
 
Thanks Zvi for your efforts. I really sorry but i can not share the credentials and URL as it is client data and i need to adhere to the client data protection policy of my organization.
I applied the code w.r.t. frames #99 and Location URL #98. But in both cases 'for' loop gets executed only once.
It seems system is treating it as a single window. When i applied code related to Frame then the title of parent window gets printed. Below is the HTML Code
HTML:
<head>...</head>
****** class="PSPAGE" id="ptiframetemplate" style="cursor: auto;">
		<div id ="ptpopupmask" style="display: none;"></div>
		<div>...</div>
		<div id = "ptiframecontent">...</div>
		<div class = "ptalpagemask" id = "ptalpagemask"></div>
		<div class = "prcsmsgwindow" id = "NewProcessmsgwindow" style= "right: 0px; display: none;" ></div>
		<div id = "pt_modalmask" style= "width: 1384px; height: 580px; display: none;" ></div>
		<div id = "pt_modalmaskCover"></div>
		<div class = "PSMODAL" id = "pt_modals" style= "display: none; background-color: transparent" >...</div>
</body>

When i verify the element ID in parent window by pressing F12 and selecting field, it expands the
HTML:
<div id = "ptiframecontent">
. At this time, there is minimal data in
HTML:
<div class = "PSMODAL">
division. However as soon as i click the link to open popup window, the data gets populated in
HTML:
<div class = "PSMODAL" id = "pt_modals" style= "display: none; background-color: transparent" >...</div>.
Is there any way by which i can share the screenshot with you in order to elaborate the scenarion.
This is much required for me as i am trying to introduce robotics in my project. Please help.

Regards;
Aditya jain
 
Last edited:
Upvote 0

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
If system threats it as a single window, then seems it is dynamic page and you need to parse its content.
My participation in this long thread is limited by what is in the title "VBA Macro For Already Open IE Window", which is not web page scraping itself.
And as for me there is no way to debug via screenshots, but may be someone has faced with a similar problem.
To involve experts with the appropriate skills it is better to create new thread.
Hope you will find the solution, good luck!
 
Last edited:
Upvote 0
Thanks Zvi for your support on the issue. I am submitting the partial automation idea. In case i will receive the positive feedback, then i will indulge more. Thanks Again.

Regards:
Aditya jain
 
Upvote 0
I don't understand, thats mean navigate manually?. I have the same problem that sugaprasad, I need replace the actually URL, that's because I have to choice an option ("button") in a menu, but that button doesn't have an id or a tag, but I can see that the "button" just redirects me to some other url. I don't need open another tab because that mean log-in every time. Can anyone help me??.. Hmm sorry for the mistakes but I'm still learning English.
 
Upvote 0
Hi ZVI,

I am trying to replace the existing URL in the address bar of already opened IE window. So far this is my code.

Code:
Sub Replace_URL()

  Dim shellWins As ShellWindows
  Dim ie As InternetExplorer


  Set shellWins = New ShellWindows


  If shellWins.Count > 0 Then
    ' Get IE
    Set ie = shellWins.Item(0)
  Else
    ' Create IE
    Set ie = New InternetExplorer
    ie.Visible = True
  End If


   
  ie.navigate "javascript: $find('ReportViewerControl').exportReport('EXCEL');"








  Set shellWins = Nothing
  Set ie = Nothing


End Sub
Here its goes in to else part. But the navigate link is opening in a new tab. but i want this to replace the url in existing tab.
Is this can be done. Please help me.



I have the same problem that sugaprasad, I need replace the actually URL, that's because I have to choice an option ("button") in a menu, but that button doesn't have an id or a tag, but I can see that the "button" just redirects me to some other url. I don't need open another tab because that mean log-in every time. Can anyone help me??.. Hmm sorry for the mistakes but I'm still learning English.
 
Upvote 0

Forum statistics

Threads
1,214,780
Messages
6,121,527
Members
449,037
Latest member
tmmotairi

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