Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
simulate clicking OK in msgbox
hi,
i would like to know if there is a way i can simulate clicking on the OK button of a messagebox. i have the following: msgbox zz i am wanting to do this because when i run the code, for some reason it skips over this, but when i step through it, it works... thanks in advance, geebee |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
simulate clicking OK in msgbox
don't understand what you are trying to achieve. If you simulate the clicking
of the OK button in your code then you will not see the msgbox because it will all occur too quickly. the idea of the OK button is to give the user the time they require to read the message. perhaps you can post a snippet of your code including the msgbox. -- Regards, OssieMac "geebee" wrote: hi, i would like to know if there is a way i can simulate clicking on the OK button of a messagebox. i have the following: msgbox zz i am wanting to do this because when i run the code, for some reason it skips over this, but when i step through it, it works... thanks in advance, geebee |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
simulate clicking OK in msgbox
hi,
its ok if the user does not have time to see the messagebox. i just need the OK button to automatically be clicked. thanks in advance, geebee "OssieMac" wrote: don't understand what you are trying to achieve. If you simulate the clicking of the OK button in your code then you will not see the msgbox because it will all occur too quickly. the idea of the OK button is to give the user the time they require to read the message. perhaps you can post a snippet of your code including the msgbox. -- Regards, OssieMac "geebee" wrote: hi, i would like to know if there is a way i can simulate clicking on the OK button of a messagebox. i have the following: msgbox zz i am wanting to do this because when i run the code, for some reason it skips over this, but when i step through it, it works... thanks in advance, geebee |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
simulate clicking OK in msgbox
If you dont need the msgbox comment it out by placing a single quote ' in
front of it or just remove it all together. "geebee" wrote: hi, its ok if the user does not have time to see the messagebox. i just need the OK button to automatically be clicked. thanks in advance, geebee "OssieMac" wrote: don't understand what you are trying to achieve. If you simulate the clicking of the OK button in your code then you will not see the msgbox because it will all occur too quickly. the idea of the OK button is to give the user the time they require to read the message. perhaps you can post a snippet of your code including the msgbox. -- Regards, OssieMac "geebee" wrote: hi, i would like to know if there is a way i can simulate clicking on the OK button of a messagebox. i have the following: msgbox zz i am wanting to do this because when i run the code, for some reason it skips over this, but when i step through it, it works... thanks in advance, geebee |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
simulate clicking OK in msgbox
i really need the messagebox it seems for this towork. for example when i
step through the code, i get the messageboxes. and the link in the aol page is clicked. but when i simply run the code, it doesnt work and i dont get the msgbox zz. here is the full code: Dim myIE As New InternetExplorer Public Sub EE() Dim myURL As String Dim myURL33 As String Dim myDoc As HTMLDocument Dim strSearch As String 'Set starting URL and search string myURL = "www.google.com" 'Make IE navigate to the URL and make browser visible myIE.navigate myURL myIE.Visible = True Call EE2 End Sub Sub EE2() myIE.navigate "www.aol.com " myIE.Visible = True While myIE.Busy: DoEvents: Wend Set o = myIE.document.all.tags("A") M = o.Length: mySubmit = -1 For r = 0 To M - 1: zz = "" zz = zz & "Link Index : " & r & " of " & o.Length - 1 zz = zz & String(3, vbCrLf) ' zz = zz & "A . tabindex : " & o.Item(r).tabIndex zz = zz & String(3, vbCrLf) ' zz = zz & "A . tagname : " & o.Item(r).tagName zz = zz & String(3, vbCrLf) ' zz = zz & "A . href : " & o.Item(r).href zz = zz & String(3, vbCrLf) ' zz = zz & "A . type : " & o.Item(r).Type zz = zz & String(3, vbCrLf) ' zz = zz & "A . name : " & o.Item(r).Name zz = zz & String(3, vbCrLf) ' zz = zz & "A . innerhtml : " & o.Item(r).innerHTML zz = zz & String(3, vbCrLf) ' zz = zz & "A . outerhtml : " & o.Item(r).outerHTML zz = zz & String(3, vbCrLf) ' zz = zz & "A . rel : " & o.Item(r).rel zz = zz & String(3, vbCrLf) ' zz = zz & "A . rev : " & o.Item(r).rev zz = zz & String(3, vbCrLf) ' zz = zz & "A . id : " & o.Item(r).ID zz = zz & String(3, vbCrLf) MsgBox zz If InStr(1, o.Item(r).innerHTML, "Retailers on the Brink", vbTextCompare) Then MsgBox "= F O U N D =" & vbCrLf & o.Item(r).innerHTML o.Item(r).Click: Exit For End If Next 'MsgBox "DONE" End Sub "Office_Novice" wrote: If you dont need the msgbox comment it out by placing a single quote ' in front of it or just remove it all together. "geebee" wrote: hi, its ok if the user does not have time to see the messagebox. i just need the OK button to automatically be clicked. thanks in advance, geebee "OssieMac" wrote: don't understand what you are trying to achieve. If you simulate the clicking of the OK button in your code then you will not see the msgbox because it will all occur too quickly. the idea of the OK button is to give the user the time they require to read the message. perhaps you can post a snippet of your code including the msgbox. -- Regards, OssieMac "geebee" wrote: hi, i would like to know if there is a way i can simulate clicking on the OK button of a messagebox. i have the following: msgbox zz i am wanting to do this because when i run the code, for some reason it skips over this, but when i step through it, it works... thanks in advance, geebee |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
simulate clicking OK in msgbox
Haven't followed all the thread, but try instead of the Msgbox a DoEvents
RBS "geebee" (noSPAMs) wrote in message ... i really need the messagebox it seems for this towork. for example when i step through the code, i get the messageboxes. and the link in the aol page is clicked. but when i simply run the code, it doesnt work and i dont get the msgbox zz. here is the full code: Dim myIE As New InternetExplorer Public Sub EE() Dim myURL As String Dim myURL33 As String Dim myDoc As HTMLDocument Dim strSearch As String 'Set starting URL and search string myURL = "www.google.com" 'Make IE navigate to the URL and make browser visible myIE.navigate myURL myIE.Visible = True Call EE2 End Sub Sub EE2() myIE.navigate "www.aol.com " myIE.Visible = True While myIE.Busy: DoEvents: Wend Set o = myIE.document.all.tags("A") M = o.Length: mySubmit = -1 For r = 0 To M - 1: zz = "" zz = zz & "Link Index : " & r & " of " & o.Length - 1 zz = zz & String(3, vbCrLf) ' zz = zz & "A . tabindex : " & o.Item(r).tabIndex zz = zz & String(3, vbCrLf) ' zz = zz & "A . tagname : " & o.Item(r).tagName zz = zz & String(3, vbCrLf) ' zz = zz & "A . href : " & o.Item(r).href zz = zz & String(3, vbCrLf) ' zz = zz & "A . type : " & o.Item(r).Type zz = zz & String(3, vbCrLf) ' zz = zz & "A . name : " & o.Item(r).Name zz = zz & String(3, vbCrLf) ' zz = zz & "A . innerhtml : " & o.Item(r).innerHTML zz = zz & String(3, vbCrLf) ' zz = zz & "A . outerhtml : " & o.Item(r).outerHTML zz = zz & String(3, vbCrLf) ' zz = zz & "A . rel : " & o.Item(r).rel zz = zz & String(3, vbCrLf) ' zz = zz & "A . rev : " & o.Item(r).rev zz = zz & String(3, vbCrLf) ' zz = zz & "A . id : " & o.Item(r).ID zz = zz & String(3, vbCrLf) MsgBox zz If InStr(1, o.Item(r).innerHTML, "Retailers on the Brink", vbTextCompare) Then MsgBox "= F O U N D =" & vbCrLf & o.Item(r).innerHTML o.Item(r).Click: Exit For End If Next 'MsgBox "DONE" End Sub "Office_Novice" wrote: If you dont need the msgbox comment it out by placing a single quote ' in front of it or just remove it all together. "geebee" wrote: hi, its ok if the user does not have time to see the messagebox. i just need the OK button to automatically be clicked. thanks in advance, geebee "OssieMac" wrote: don't understand what you are trying to achieve. If you simulate the clicking of the OK button in your code then you will not see the msgbox because it will all occur too quickly. the idea of the OK button is to give the user the time they require to read the message. perhaps you can post a snippet of your code including the msgbox. -- Regards, OssieMac "geebee" wrote: hi, i would like to know if there is a way i can simulate clicking on the OK button of a messagebox. i have the following: msgbox zz i am wanting to do this because when i run the code, for some reason it skips over this, but when i step through it, it works... thanks in advance, geebee |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
simulate clicking OK in msgbox
Looks like the msgbox is to allow catchup time. Try sendkeys(Key,Wait) should
do the trick. Application.SendKeys "{ENTER}", True msgbox zz -- Regards, OssieMac "geebee" wrote: i really need the messagebox it seems for this towork. for example when i step through the code, i get the messageboxes. and the link in the aol page is clicked. but when i simply run the code, it doesnt work and i dont get the msgbox zz. here is the full code: Dim myIE As New InternetExplorer Public Sub EE() Dim myURL As String Dim myURL33 As String Dim myDoc As HTMLDocument Dim strSearch As String 'Set starting URL and search string myURL = "www.google.com" 'Make IE navigate to the URL and make browser visible myIE.navigate myURL myIE.Visible = True Call EE2 End Sub Sub EE2() myIE.navigate "www.aol.com " myIE.Visible = True While myIE.Busy: DoEvents: Wend Set o = myIE.document.all.tags("A") M = o.Length: mySubmit = -1 For r = 0 To M - 1: zz = "" zz = zz & "Link Index : " & r & " of " & o.Length - 1 zz = zz & String(3, vbCrLf) ' zz = zz & "A . tabindex : " & o.Item(r).tabIndex zz = zz & String(3, vbCrLf) ' zz = zz & "A . tagname : " & o.Item(r).tagName zz = zz & String(3, vbCrLf) ' zz = zz & "A . href : " & o.Item(r).href zz = zz & String(3, vbCrLf) ' zz = zz & "A . type : " & o.Item(r).Type zz = zz & String(3, vbCrLf) ' zz = zz & "A . name : " & o.Item(r).Name zz = zz & String(3, vbCrLf) ' zz = zz & "A . innerhtml : " & o.Item(r).innerHTML zz = zz & String(3, vbCrLf) ' zz = zz & "A . outerhtml : " & o.Item(r).outerHTML zz = zz & String(3, vbCrLf) ' zz = zz & "A . rel : " & o.Item(r).rel zz = zz & String(3, vbCrLf) ' zz = zz & "A . rev : " & o.Item(r).rev zz = zz & String(3, vbCrLf) ' zz = zz & "A . id : " & o.Item(r).ID zz = zz & String(3, vbCrLf) MsgBox zz If InStr(1, o.Item(r).innerHTML, "Retailers on the Brink", vbTextCompare) Then MsgBox "= F O U N D =" & vbCrLf & o.Item(r).innerHTML o.Item(r).Click: Exit For End If Next 'MsgBox "DONE" End Sub "Office_Novice" wrote: If you dont need the msgbox comment it out by placing a single quote ' in front of it or just remove it all together. "geebee" wrote: hi, its ok if the user does not have time to see the messagebox. i just need the OK button to automatically be clicked. thanks in advance, geebee "OssieMac" wrote: don't understand what you are trying to achieve. If you simulate the clicking of the OK button in your code then you will not see the msgbox because it will all occur too quickly. the idea of the OK button is to give the user the time they require to read the message. perhaps you can post a snippet of your code including the msgbox. -- Regards, OssieMac "geebee" wrote: hi, i would like to know if there is a way i can simulate clicking on the OK button of a messagebox. i have the following: msgbox zz i am wanting to do this because when i run the code, for some reason it skips over this, but when i step through it, it works... thanks in advance, geebee |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
simulate clicking OK in msgbox
hi,
this is what i now have...I added the Application.SendKeys "{ENTER}", True before and after the msgbox zz. it works to automate clicking ok in the many messageboxes, but it looks like i have to go in and click the first one because the focus is put on the internet page and is lot from excel. so the web page is open, then i go to excel and clikc the first ok. all the others are clicked automatically. how can i make it to where i dont have to click the first one? (maybe i just need top put the focus on excel after the web page is opened and then put it back on IE). im not sure. Dim myIE As New InternetExplorer Public Sub EE() Dim myURL As String Dim myURL33 As String Dim myDoc As HTMLDocument Dim strSearch As String 'Set starting URL and search string myURL = "www.google.com" 'Make IE navigate to the URL and make browser visible myIE.navigate myURL myIE.Visible = True Call EE2 End Sub Sub EE2() myIE.navigate "www.aol.com " myIE.Visible = True While myIE.Busy: DoEvents: Wend Set o = myIE.document.all.tags("A") M = o.Length: mySubmit = -1 For r = 0 To M - 1: zz = "" zz = zz & "Link Index : " & r & " of " & o.Length - 1 zz = zz & String(3, vbCrLf) ' zz = zz & "A . tabindex : " & o.Item(r).tabIndex zz = zz & String(3, vbCrLf) ' zz = zz & "A . tagname : " & o.Item(r).tagName zz = zz & String(3, vbCrLf) ' zz = zz & "A . href : " & o.Item(r).href zz = zz & String(3, vbCrLf) ' zz = zz & "A . type : " & o.Item(r).Type zz = zz & String(3, vbCrLf) ' zz = zz & "A . name : " & o.Item(r).Name zz = zz & String(3, vbCrLf) ' zz = zz & "A . innerhtml : " & o.Item(r).innerHTML zz = zz & String(3, vbCrLf) ' zz = zz & "A . outerhtml : " & o.Item(r).outerHTML zz = zz & String(3, vbCrLf) ' zz = zz & "A . rel : " & o.Item(r).rel zz = zz & String(3, vbCrLf) ' zz = zz & "A . rev : " & o.Item(r).rev zz = zz & String(3, vbCrLf) ' zz = zz & "A . id : " & o.Item(r).ID zz = zz & String(3, vbCrLf) Application.SendKeys "{ENTER}", True MsgBox zz Application.SendKeys "{ENTER}", True If InStr(1, o.Item(r).innerHTML, "Investigators Say Anthrax Suspect Acted Alone", vbTextCompare) Then MsgBox "= F O U N D =" & vbCrLf & o.Item(r).innerHTML o.Item(r).Click: Exit For End If Next End Sub thanks in advance, geebee "OssieMac" wrote: Looks like the msgbox is to allow catchup time. Try sendkeys(Key,Wait) should do the trick. Application.SendKeys "{ENTER}", True msgbox zz -- Regards, OssieMac "geebee" wrote: i really need the messagebox it seems for this towork. for example when i step through the code, i get the messageboxes. and the link in the aol page is clicked. but when i simply run the code, it doesnt work and i dont get the msgbox zz. here is the full code: Dim myIE As New InternetExplorer Public Sub EE() Dim myURL As String Dim myURL33 As String Dim myDoc As HTMLDocument Dim strSearch As String 'Set starting URL and search string myURL = "www.google.com" 'Make IE navigate to the URL and make browser visible myIE.navigate myURL myIE.Visible = True Call EE2 End Sub Sub EE2() myIE.navigate "www.aol.com " myIE.Visible = True While myIE.Busy: DoEvents: Wend Set o = myIE.document.all.tags("A") M = o.Length: mySubmit = -1 For r = 0 To M - 1: zz = "" zz = zz & "Link Index : " & r & " of " & o.Length - 1 zz = zz & String(3, vbCrLf) ' zz = zz & "A . tabindex : " & o.Item(r).tabIndex zz = zz & String(3, vbCrLf) ' zz = zz & "A . tagname : " & o.Item(r).tagName zz = zz & String(3, vbCrLf) ' zz = zz & "A . href : " & o.Item(r).href zz = zz & String(3, vbCrLf) ' zz = zz & "A . type : " & o.Item(r).Type zz = zz & String(3, vbCrLf) ' zz = zz & "A . name : " & o.Item(r).Name zz = zz & String(3, vbCrLf) ' zz = zz & "A . innerhtml : " & o.Item(r).innerHTML zz = zz & String(3, vbCrLf) ' zz = zz & "A . outerhtml : " & o.Item(r).outerHTML zz = zz & String(3, vbCrLf) ' zz = zz & "A . rel : " & o.Item(r).rel zz = zz & String(3, vbCrLf) ' zz = zz & "A . rev : " & o.Item(r).rev zz = zz & String(3, vbCrLf) ' zz = zz & "A . id : " & o.Item(r).ID zz = zz & String(3, vbCrLf) MsgBox zz If InStr(1, o.Item(r).innerHTML, "Retailers on the Brink", vbTextCompare) Then MsgBox "= F O U N D =" & vbCrLf & o.Item(r).innerHTML o.Item(r).Click: Exit For End If Next 'MsgBox "DONE" End Sub "Office_Novice" wrote: If you dont need the msgbox comment it out by placing a single quote ' in front of it or just remove it all together. "geebee" wrote: hi, its ok if the user does not have time to see the messagebox. i just need the OK button to automatically be clicked. thanks in advance, geebee "OssieMac" wrote: don't understand what you are trying to achieve. If you simulate the clicking of the OK button in your code then you will not see the msgbox because it will all occur too quickly. the idea of the OK button is to give the user the time they require to read the message. perhaps you can post a snippet of your code including the msgbox. -- Regards, OssieMac "geebee" wrote: hi, i would like to know if there is a way i can simulate clicking on the OK button of a messagebox. i have the following: msgbox zz i am wanting to do this because when i run the code, for some reason it skips over this, but when i step through it, it works... thanks in advance, geebee |
#9
Posted to microsoft.public.excel.programming
|
|||
|
|||
simulate clicking OK in msgbox
You are into an area that I don't know anything about. From your answer, I am
ssuming that my reply solved one of your problems but I really can't answer your last question. Perhaps you should start another thread with your latest problem as the specific question. -- Regards, OssieMac "geebee" wrote: hi, this is what i now have...I added the Application.SendKeys "{ENTER}", True before and after the msgbox zz. it works to automate clicking ok in the many messageboxes, but it looks like i have to go in and click the first one because the focus is put on the internet page and is lot from excel. so the web page is open, then i go to excel and clikc the first ok. all the others are clicked automatically. how can i make it to where i dont have to click the first one? (maybe i just need top put the focus on excel after the web page is opened and then put it back on IE). im not sure. Dim myIE As New InternetExplorer Public Sub EE() Dim myURL As String Dim myURL33 As String Dim myDoc As HTMLDocument Dim strSearch As String 'Set starting URL and search string myURL = "www.google.com" 'Make IE navigate to the URL and make browser visible myIE.navigate myURL myIE.Visible = True Call EE2 End Sub Sub EE2() myIE.navigate "www.aol.com " myIE.Visible = True While myIE.Busy: DoEvents: Wend Set o = myIE.document.all.tags("A") M = o.Length: mySubmit = -1 For r = 0 To M - 1: zz = "" zz = zz & "Link Index : " & r & " of " & o.Length - 1 zz = zz & String(3, vbCrLf) ' zz = zz & "A . tabindex : " & o.Item(r).tabIndex zz = zz & String(3, vbCrLf) ' zz = zz & "A . tagname : " & o.Item(r).tagName zz = zz & String(3, vbCrLf) ' zz = zz & "A . href : " & o.Item(r).href zz = zz & String(3, vbCrLf) ' zz = zz & "A . type : " & o.Item(r).Type zz = zz & String(3, vbCrLf) ' zz = zz & "A . name : " & o.Item(r).Name zz = zz & String(3, vbCrLf) ' zz = zz & "A . innerhtml : " & o.Item(r).innerHTML zz = zz & String(3, vbCrLf) ' zz = zz & "A . outerhtml : " & o.Item(r).outerHTML zz = zz & String(3, vbCrLf) ' zz = zz & "A . rel : " & o.Item(r).rel zz = zz & String(3, vbCrLf) ' zz = zz & "A . rev : " & o.Item(r).rev zz = zz & String(3, vbCrLf) ' zz = zz & "A . id : " & o.Item(r).ID zz = zz & String(3, vbCrLf) Application.SendKeys "{ENTER}", True MsgBox zz Application.SendKeys "{ENTER}", True If InStr(1, o.Item(r).innerHTML, "Investigators Say Anthrax Suspect Acted Alone", vbTextCompare) Then MsgBox "= F O U N D =" & vbCrLf & o.Item(r).innerHTML o.Item(r).Click: Exit For End If Next End Sub thanks in advance, geebee "OssieMac" wrote: Looks like the msgbox is to allow catchup time. Try sendkeys(Key,Wait) should do the trick. Application.SendKeys "{ENTER}", True msgbox zz -- Regards, OssieMac "geebee" wrote: i really need the messagebox it seems for this towork. for example when i step through the code, i get the messageboxes. and the link in the aol page is clicked. but when i simply run the code, it doesnt work and i dont get the msgbox zz. here is the full code: Dim myIE As New InternetExplorer Public Sub EE() Dim myURL As String Dim myURL33 As String Dim myDoc As HTMLDocument Dim strSearch As String 'Set starting URL and search string myURL = "www.google.com" 'Make IE navigate to the URL and make browser visible myIE.navigate myURL myIE.Visible = True Call EE2 End Sub Sub EE2() myIE.navigate "www.aol.com " myIE.Visible = True While myIE.Busy: DoEvents: Wend Set o = myIE.document.all.tags("A") M = o.Length: mySubmit = -1 For r = 0 To M - 1: zz = "" zz = zz & "Link Index : " & r & " of " & o.Length - 1 zz = zz & String(3, vbCrLf) ' zz = zz & "A . tabindex : " & o.Item(r).tabIndex zz = zz & String(3, vbCrLf) ' zz = zz & "A . tagname : " & o.Item(r).tagName zz = zz & String(3, vbCrLf) ' zz = zz & "A . href : " & o.Item(r).href zz = zz & String(3, vbCrLf) ' zz = zz & "A . type : " & o.Item(r).Type zz = zz & String(3, vbCrLf) ' zz = zz & "A . name : " & o.Item(r).Name zz = zz & String(3, vbCrLf) ' zz = zz & "A . innerhtml : " & o.Item(r).innerHTML zz = zz & String(3, vbCrLf) ' zz = zz & "A . outerhtml : " & o.Item(r).outerHTML zz = zz & String(3, vbCrLf) ' zz = zz & "A . rel : " & o.Item(r).rel zz = zz & String(3, vbCrLf) ' zz = zz & "A . rev : " & o.Item(r).rev zz = zz & String(3, vbCrLf) ' zz = zz & "A . id : " & o.Item(r).ID zz = zz & String(3, vbCrLf) MsgBox zz If InStr(1, o.Item(r).innerHTML, "Retailers on the Brink", vbTextCompare) Then MsgBox "= F O U N D =" & vbCrLf & o.Item(r).innerHTML o.Item(r).Click: Exit For End If Next 'MsgBox "DONE" End Sub "Office_Novice" wrote: If you dont need the msgbox comment it out by placing a single quote ' in front of it or just remove it all together. "geebee" wrote: hi, its ok if the user does not have time to see the messagebox. i just need the OK button to automatically be clicked. thanks in advance, geebee "OssieMac" wrote: don't understand what you are trying to achieve. If you simulate the clicking of the OK button in your code then you will not see the msgbox because it will all occur too quickly. the idea of the OK button is to give the user the time they require to read the message. perhaps you can post a snippet of your code including the msgbox. -- Regards, OssieMac "geebee" wrote: hi, i would like to know if there is a way i can simulate clicking on the OK button of a messagebox. i have the following: msgbox zz i am wanting to do this because when i run the code, for some reason it skips over this, but when i step through it, it works... thanks in advance, geebee |
#10
Posted to microsoft.public.excel.programming
|
|||
|
|||
simulate clicking OK in msgbox
hi,
you hellped me out with the Application.SendKeys "{ENTER}", True a month ago... now, i would like to revise this so that {Ctrl} and the "A" key are pressed at the same time? would you know the code for this? thanks in advance, geebee "OssieMac" wrote: Looks like the msgbox is to allow catchup time. Try sendkeys(Key,Wait) should do the trick. Application.SendKeys "{ENTER}", True msgbox zz -- Regards, OssieMac "geebee" wrote: i really need the messagebox it seems for this towork. for example when i step through the code, i get the messageboxes. and the link in the aol page is clicked. but when i simply run the code, it doesnt work and i dont get the msgbox zz. here is the full code: Dim myIE As New InternetExplorer Public Sub EE() Dim myURL As String Dim myURL33 As String Dim myDoc As HTMLDocument Dim strSearch As String 'Set starting URL and search string myURL = "www.google.com" 'Make IE navigate to the URL and make browser visible myIE.navigate myURL myIE.Visible = True Call EE2 End Sub Sub EE2() myIE.navigate "www.aol.com " myIE.Visible = True While myIE.Busy: DoEvents: Wend Set o = myIE.document.all.tags("A") M = o.Length: mySubmit = -1 For r = 0 To M - 1: zz = "" zz = zz & "Link Index : " & r & " of " & o.Length - 1 zz = zz & String(3, vbCrLf) ' zz = zz & "A . tabindex : " & o.Item(r).tabIndex zz = zz & String(3, vbCrLf) ' zz = zz & "A . tagname : " & o.Item(r).tagName zz = zz & String(3, vbCrLf) ' zz = zz & "A . href : " & o.Item(r).href zz = zz & String(3, vbCrLf) ' zz = zz & "A . type : " & o.Item(r).Type zz = zz & String(3, vbCrLf) ' zz = zz & "A . name : " & o.Item(r).Name zz = zz & String(3, vbCrLf) ' zz = zz & "A . innerhtml : " & o.Item(r).innerHTML zz = zz & String(3, vbCrLf) ' zz = zz & "A . outerhtml : " & o.Item(r).outerHTML zz = zz & String(3, vbCrLf) ' zz = zz & "A . rel : " & o.Item(r).rel zz = zz & String(3, vbCrLf) ' zz = zz & "A . rev : " & o.Item(r).rev zz = zz & String(3, vbCrLf) ' zz = zz & "A . id : " & o.Item(r).ID zz = zz & String(3, vbCrLf) MsgBox zz If InStr(1, o.Item(r).innerHTML, "Retailers on the Brink", vbTextCompare) Then MsgBox "= F O U N D =" & vbCrLf & o.Item(r).innerHTML o.Item(r).Click: Exit For End If Next 'MsgBox "DONE" End Sub "Office_Novice" wrote: If you dont need the msgbox comment it out by placing a single quote ' in front of it or just remove it all together. "geebee" wrote: hi, its ok if the user does not have time to see the messagebox. i just need the OK button to automatically be clicked. thanks in advance, geebee "OssieMac" wrote: don't understand what you are trying to achieve. If you simulate the clicking of the OK button in your code then you will not see the msgbox because it will all occur too quickly. the idea of the OK button is to give the user the time they require to read the message. perhaps you can post a snippet of your code including the msgbox. -- Regards, OssieMac "geebee" wrote: hi, i would like to know if there is a way i can simulate clicking on the OK button of a messagebox. i have the following: msgbox zz i am wanting to do this because when i run the code, for some reason it skips over this, but when i step through it, it works... thanks in advance, geebee |
#11
Posted to microsoft.public.excel.programming
|
|||
|
|||
simulate clicking OK in msgbox
Application.SendKeys "^a" or 'Force wait for keys to process before resuming code. Application.SendKeys "^a", True You will find all of these under Application.SendKeys in Help -- Regards, OssieMac "geebee" wrote: hi, you hellped me out with the Application.SendKeys "{ENTER}", True a month ago... now, i would like to revise this so that {Ctrl} and the "A" key are pressed at the same time? would you know the code for this? thanks in advance, geebee "OssieMac" wrote: Looks like the msgbox is to allow catchup time. Try sendkeys(Key,Wait) should do the trick. Application.SendKeys "{ENTER}", True msgbox zz -- Regards, OssieMac "geebee" wrote: i really need the messagebox it seems for this towork. for example when i step through the code, i get the messageboxes. and the link in the aol page is clicked. but when i simply run the code, it doesnt work and i dont get the msgbox zz. here is the full code: Dim myIE As New InternetExplorer Public Sub EE() Dim myURL As String Dim myURL33 As String Dim myDoc As HTMLDocument Dim strSearch As String 'Set starting URL and search string myURL = "www.google.com" 'Make IE navigate to the URL and make browser visible myIE.navigate myURL myIE.Visible = True Call EE2 End Sub Sub EE2() myIE.navigate "www.aol.com " myIE.Visible = True While myIE.Busy: DoEvents: Wend Set o = myIE.document.all.tags("A") M = o.Length: mySubmit = -1 For r = 0 To M - 1: zz = "" zz = zz & "Link Index : " & r & " of " & o.Length - 1 zz = zz & String(3, vbCrLf) ' zz = zz & "A . tabindex : " & o.Item(r).tabIndex zz = zz & String(3, vbCrLf) ' zz = zz & "A . tagname : " & o.Item(r).tagName zz = zz & String(3, vbCrLf) ' zz = zz & "A . href : " & o.Item(r).href zz = zz & String(3, vbCrLf) ' zz = zz & "A . type : " & o.Item(r).Type zz = zz & String(3, vbCrLf) ' zz = zz & "A . name : " & o.Item(r).Name zz = zz & String(3, vbCrLf) ' zz = zz & "A . innerhtml : " & o.Item(r).innerHTML zz = zz & String(3, vbCrLf) ' zz = zz & "A . outerhtml : " & o.Item(r).outerHTML zz = zz & String(3, vbCrLf) ' zz = zz & "A . rel : " & o.Item(r).rel zz = zz & String(3, vbCrLf) ' zz = zz & "A . rev : " & o.Item(r).rev zz = zz & String(3, vbCrLf) ' zz = zz & "A . id : " & o.Item(r).ID zz = zz & String(3, vbCrLf) MsgBox zz If InStr(1, o.Item(r).innerHTML, "Retailers on the Brink", vbTextCompare) Then MsgBox "= F O U N D =" & vbCrLf & o.Item(r).innerHTML o.Item(r).Click: Exit For End If Next 'MsgBox "DONE" End Sub "Office_Novice" wrote: If you dont need the msgbox comment it out by placing a single quote ' in front of it or just remove it all together. "geebee" wrote: hi, its ok if the user does not have time to see the messagebox. i just need the OK button to automatically be clicked. thanks in advance, geebee "OssieMac" wrote: don't understand what you are trying to achieve. If you simulate the clicking of the OK button in your code then you will not see the msgbox because it will all occur too quickly. the idea of the OK button is to give the user the time they require to read the message. perhaps you can post a snippet of your code including the msgbox. -- Regards, OssieMac "geebee" wrote: hi, i would like to know if there is a way i can simulate clicking on the OK button of a messagebox. i have the following: msgbox zz i am wanting to do this because when i run the code, for some reason it skips over this, but when i step through it, it works... thanks in advance, geebee |
#12
Posted to microsoft.public.excel.programming
|
|||
|
|||
simulate clicking OK in msgbox
hi,
for some reason it is not doing anything at all. but at the same time i am not getting an error message. keep in mind i am wanting to work in IE: Dim lHwnd4 As Long lHwnd4 = FindWindow("IEframe", vbNullString) 'determine if there is IE open If lHwnd4 < 0 Then ShowWindow lHwnd4, SW_SHOWNORMAL Dim XT4 As Long XT4 = BringWindowToTop(lHwnd4) 'brings the IE window to top Windows.Application.SendKeys "^A", True End If any ideas? thanks in advance, geebee "OssieMac" wrote: Application.SendKeys "^a" or 'Force wait for keys to process before resuming code. Application.SendKeys "^a", True You will find all of these under Application.SendKeys in Help -- Regards, OssieMac "geebee" wrote: hi, you hellped me out with the Application.SendKeys "{ENTER}", True a month ago... now, i would like to revise this so that {Ctrl} and the "A" key are pressed at the same time? would you know the code for this? thanks in advance, geebee "OssieMac" wrote: Looks like the msgbox is to allow catchup time. Try sendkeys(Key,Wait) should do the trick. Application.SendKeys "{ENTER}", True msgbox zz -- Regards, OssieMac "geebee" wrote: i really need the messagebox it seems for this towork. for example when i step through the code, i get the messageboxes. and the link in the aol page is clicked. but when i simply run the code, it doesnt work and i dont get the msgbox zz. here is the full code: Dim myIE As New InternetExplorer Public Sub EE() Dim myURL As String Dim myURL33 As String Dim myDoc As HTMLDocument Dim strSearch As String 'Set starting URL and search string myURL = "www.google.com" 'Make IE navigate to the URL and make browser visible myIE.navigate myURL myIE.Visible = True Call EE2 End Sub Sub EE2() myIE.navigate "www.aol.com " myIE.Visible = True While myIE.Busy: DoEvents: Wend Set o = myIE.document.all.tags("A") M = o.Length: mySubmit = -1 For r = 0 To M - 1: zz = "" zz = zz & "Link Index : " & r & " of " & o.Length - 1 zz = zz & String(3, vbCrLf) ' zz = zz & "A . tabindex : " & o.Item(r).tabIndex zz = zz & String(3, vbCrLf) ' zz = zz & "A . tagname : " & o.Item(r).tagName zz = zz & String(3, vbCrLf) ' zz = zz & "A . href : " & o.Item(r).href zz = zz & String(3, vbCrLf) ' zz = zz & "A . type : " & o.Item(r).Type zz = zz & String(3, vbCrLf) ' zz = zz & "A . name : " & o.Item(r).Name zz = zz & String(3, vbCrLf) ' zz = zz & "A . innerhtml : " & o.Item(r).innerHTML zz = zz & String(3, vbCrLf) ' zz = zz & "A . outerhtml : " & o.Item(r).outerHTML zz = zz & String(3, vbCrLf) ' zz = zz & "A . rel : " & o.Item(r).rel zz = zz & String(3, vbCrLf) ' zz = zz & "A . rev : " & o.Item(r).rev zz = zz & String(3, vbCrLf) ' zz = zz & "A . id : " & o.Item(r).ID zz = zz & String(3, vbCrLf) MsgBox zz If InStr(1, o.Item(r).innerHTML, "Retailers on the Brink", vbTextCompare) Then MsgBox "= F O U N D =" & vbCrLf & o.Item(r).innerHTML o.Item(r).Click: Exit For End If Next 'MsgBox "DONE" End Sub "Office_Novice" wrote: If you dont need the msgbox comment it out by placing a single quote ' in front of it or just remove it all together. "geebee" wrote: hi, its ok if the user does not have time to see the messagebox. i just need the OK button to automatically be clicked. thanks in advance, geebee "OssieMac" wrote: don't understand what you are trying to achieve. If you simulate the clicking of the OK button in your code then you will not see the msgbox because it will all occur too quickly. the idea of the OK button is to give the user the time they require to read the message. perhaps you can post a snippet of your code including the msgbox. -- Regards, OssieMac "geebee" wrote: hi, i would like to know if there is a way i can simulate clicking on the OK button of a messagebox. i have the following: msgbox zz i am wanting to do this because when i run the code, for some reason it skips over this, but when i step through it, it works... thanks in advance, geebee |
#13
Posted to microsoft.public.excel.programming
|
|||
|
|||
simulate clicking OK in msgbox
sorry. Can't help
-- Regards, OssieMac "geebee" wrote: hi, for some reason it is not doing anything at all. but at the same time i am not getting an error message. keep in mind i am wanting to work in IE: Dim lHwnd4 As Long lHwnd4 = FindWindow("IEframe", vbNullString) 'determine if there is IE open If lHwnd4 < 0 Then ShowWindow lHwnd4, SW_SHOWNORMAL Dim XT4 As Long XT4 = BringWindowToTop(lHwnd4) 'brings the IE window to top Windows.Application.SendKeys "^A", True End If any ideas? thanks in advance, geebee "OssieMac" wrote: Application.SendKeys "^a" or 'Force wait for keys to process before resuming code. Application.SendKeys "^a", True You will find all of these under Application.SendKeys in Help -- Regards, OssieMac "geebee" wrote: hi, you hellped me out with the Application.SendKeys "{ENTER}", True a month ago... now, i would like to revise this so that {Ctrl} and the "A" key are pressed at the same time? would you know the code for this? thanks in advance, geebee "OssieMac" wrote: Looks like the msgbox is to allow catchup time. Try sendkeys(Key,Wait) should do the trick. Application.SendKeys "{ENTER}", True msgbox zz -- Regards, OssieMac "geebee" wrote: i really need the messagebox it seems for this towork. for example when i step through the code, i get the messageboxes. and the link in the aol page is clicked. but when i simply run the code, it doesnt work and i dont get the msgbox zz. here is the full code: Dim myIE As New InternetExplorer Public Sub EE() Dim myURL As String Dim myURL33 As String Dim myDoc As HTMLDocument Dim strSearch As String 'Set starting URL and search string myURL = "www.google.com" 'Make IE navigate to the URL and make browser visible myIE.navigate myURL myIE.Visible = True Call EE2 End Sub Sub EE2() myIE.navigate "www.aol.com " myIE.Visible = True While myIE.Busy: DoEvents: Wend Set o = myIE.document.all.tags("A") M = o.Length: mySubmit = -1 For r = 0 To M - 1: zz = "" zz = zz & "Link Index : " & r & " of " & o.Length - 1 zz = zz & String(3, vbCrLf) ' zz = zz & "A . tabindex : " & o.Item(r).tabIndex zz = zz & String(3, vbCrLf) ' zz = zz & "A . tagname : " & o.Item(r).tagName zz = zz & String(3, vbCrLf) ' zz = zz & "A . href : " & o.Item(r).href zz = zz & String(3, vbCrLf) ' zz = zz & "A . type : " & o.Item(r).Type zz = zz & String(3, vbCrLf) ' zz = zz & "A . name : " & o.Item(r).Name zz = zz & String(3, vbCrLf) ' zz = zz & "A . innerhtml : " & o.Item(r).innerHTML zz = zz & String(3, vbCrLf) ' zz = zz & "A . outerhtml : " & o.Item(r).outerHTML zz = zz & String(3, vbCrLf) ' zz = zz & "A . rel : " & o.Item(r).rel zz = zz & String(3, vbCrLf) ' zz = zz & "A . rev : " & o.Item(r).rev zz = zz & String(3, vbCrLf) ' zz = zz & "A . id : " & o.Item(r).ID zz = zz & String(3, vbCrLf) MsgBox zz If InStr(1, o.Item(r).innerHTML, "Retailers on the Brink", vbTextCompare) Then MsgBox "= F O U N D =" & vbCrLf & o.Item(r).innerHTML o.Item(r).Click: Exit For End If Next 'MsgBox "DONE" End Sub "Office_Novice" wrote: If you dont need the msgbox comment it out by placing a single quote ' in front of it or just remove it all together. "geebee" wrote: hi, its ok if the user does not have time to see the messagebox. i just need the OK button to automatically be clicked. thanks in advance, geebee "OssieMac" wrote: don't understand what you are trying to achieve. If you simulate the clicking of the OK button in your code then you will not see the msgbox because it will all occur too quickly. the idea of the OK button is to give the user the time they require to read the message. perhaps you can post a snippet of your code including the msgbox. -- Regards, OssieMac "geebee" wrote: hi, i would like to know if there is a way i can simulate clicking on the OK button of a messagebox. i have the following: msgbox zz i am wanting to do this because when i run the code, for some reason it skips over this, but when i step through it, it works... thanks in advance, geebee |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Simulate Check Box | Excel Discussion (Misc queries) | |||
Simulate left click... | Excel Programming | |||
simulate down arrow | Excel Programming | |||
Macro to Simulate F2 | Excel Programming | |||
Can I programmatically simulate clicking the 'stop macro' button in the VBE? | Excel Programming |