RAYLWARD102
Well-known Member
- Joined
- May 27, 2010
- Messages
- 529
I have a need, for grabbing clipboard data from web pages already opened on my computer. I'm able to loop through these pages and determine which ones are my intended sources, but haven't been able to find a way to bring these webpages forward, to focus. Once I get passed the page being up and in focus, I'll be able to sendkeys to initiate the clipboard copy. The source webpages are web pdf's (none of the links allow me to download the pdf files; otherwise I would and already have a macro for opening, extracting via clipboard, and closing the pdf file)
So far I've been playing with the following code samples and don't know how to bring the internet explorer window into focus. Actually it does bring the internet window into focus; but I also need the tab brought into focus (I don't need help with the extraction stuff afterwards)
or
So far I've been playing with the following code samples and don't know how to bring the internet explorer window into focus. Actually it does bring the internet window into focus; but I also need the tab brought into focus (I don't need help with the extraction stuff afterwards)
Code:
Dim objShellWindows As New SHDocVw.ShellWindows
Dim win As Object, rv As SHDocVw.InternetExplorer
Dim go As Boolean
For Each win In objShellWindows
If TypeName(win.Document) = "Object" Then 'opened pdf via browser
If InStr(1, win.LocationName, "ViewPdfSet", vbTextCompare) Then 'is in the url and helps me detect these exact pages
Set rv = win
Debug.Print win.LocationName
rv.Visible = False
rv.Top = 0
rv.Left = 0
rv.Visible = True
End If
End If
Next win
Set objShellWindows = Nothing
Set win = Nothing
Set rv = Nothing
or
Code:
Dim w As SHDocVw.InternetExplorer
Dim window As Object
For Each window In CreateObject("Shell.Application").Windows
With window
Debug.Print window.Title
If InStr(1, .Name, "Internet Explorer", vbTextCompare) Then
If InStr(1, .LocationName, "ViewPdfSet", vbTextCompare) Then
'bring focus from here????
End If
End If
End With
Next window
Set window = Nothing
[CODE]
Last edited: