Re: VBA and switching focus between applications
- From: "Valmont" <notrelevant@xxxxxxxxxxxxx>
- Date: Mon, 24 Mar 2008 13:39:36 +0100
The answer is :
AppActivate "paste.doc - Microsoft Word", True
The next question is: how do I select the entire webpage so all its contents
are copied, not just a randomly - unknown - selected control?
Gosh I feel noob-like :).
"Valmont" <notrelevant@xxxxxxxxxxxxx> schreef in bericht
news:47e79fed$0$2842$6c4159fb@xxxxxxxxxxxxxxxxxxxx
Well, I came up with this:
Private Sub CommandButton1_Click()
AppActivate "Google - Mozilla Firefox"
SendKeys "^a"
SendKeys "^c"
AppActivate "paste.doc - Microsoft Word"
SendKeys "^v"
End Sub
However, "^V" (pasting) doesn't work although the copied content is in the
clipboard. Any suggestions?
"JP" <jp2112@xxxxxxxxxxxxx> schreef in bericht
news:7ec652d0-5c89-40c9-ad54-b3378c4e8d06@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I have some sample code for automating Internet Explorer here:
http://codeforexcelandoutlook.com/automateinetexplorer.html
http://tinyurl.com/2twmh9
It depends on what type of website you are accessing, but a lot of
them can be accessed via code. Keep in mind it might be less tedious
to push a button, but the VBA code in many cases will be slower.
HTH,
JP
On Mar 19, 2:47 pm, "Valmont" <notrelev...@xxxxxxxxxxxxx> wrote:
An employee works with a VBA application (form in Word 2003), side by
side
with a page on Internet Explorer. From that webpage he copies manually
data to controls in the userform. This costs too much (time).
My solution would be to build additional functions in VBA. It goes like
this:
1) Press a button on the form.
2) The code behind "button_clicked" event switches focus to the open
Internet Explorer webpage (defined by the windowtitle in he blue area).
3) I use sendkeys CTRL_A then CTRL_Copy to copy the webpage contents to
the clipboard.
4) Event switches back to the VBA form (Word 2003 instance).
5) VBA code analyses the data on the clipboard and copies the right
stuff
to the controls.
.
- Follow-Ups:
- Re: VBA and switching focus between applications
- From: Valmont
- Re: VBA and switching focus between applications
- References:
- VBA and switching focus between applications
- From: Paris Hilton
- Re: VBA and switching focus between applications
- From: Valmont
- Re: VBA and switching focus between applications
- From: JP
- Re: VBA and switching focus between applications
- From: Valmont
- VBA and switching focus between applications
- Prev by Date: Re: VBA and switching focus between applications
- Next by Date: Re: VBA and switching focus between applications
- Previous by thread: Re: VBA and switching focus between applications
- Next by thread: Re: VBA and switching focus between applications
- Index(es):