Cardbox > Forums > Macros and Programming > "Using Internet Explorer for Cardbox message - how to give focus to IE window"
Using Internet Explorer for Cardbox message - how to give focus to IE window
Current user: [none] |
| Posted By | Post |
|---|---|
Mary Doyle (DAF) | 29-Jul-2008 10:32 Hi All, My problem is that Internet Explorer and the new window giving the message to the user doesn't automatically get the focus i.e. it stays minimised in the task bar, though it does at least flash. Nevertheless the user has to click on it to view it. Below is the basic macro I have started experimenting with to generate the message using IE. If anyone has tried this successfully before and would like to share it, it could save me some work trying to work it out for myself. Many thanks. Mary Set objExplorer = CreateObject("InternetExplorer.Application") .Document.Body.InnerHTML = "Message test from Cardbox" End With Set objExplorer = Nothing |
bert | 29-Jul-2008 11:37 Mary, Kind Regards, |
bert | 29-Jul-2008 13:04 Hi Mary, |
bert | 29-Jul-2008 13:56 Mary, I now found a source which I think will help you. I tried e tested, seens to work good. One important thing: fill sHTMLTitle on the rigt way. Is essential. Succes, Dim oShell, oWSHShell, sTitle, wndw, bMatch, IE bMatch = false if bMatch then oWSHShell.AppActivate sHTMLTitle else |
Mary Doyle (DAF) | 29-Jul-2008 14:29 Hi Bert, Very many thanks for all that research. I have tried shutting IE and, as you said, IE got the focus. I will try your 2nd solution later, as I am a bit tied up now. I will report back on the outcome. It will be very handy if it works as people might pay more attention to the messages if they are more prominent. The Pause message in Cardbox is so small and hard to read that I find people only half read it. Thanks again. Mary |
Charles Welling | 29-Jul-2008 14:40 I may be missing something, but what is wrong with run "c:\MyMessages\Message01.htm" The default browser is started with focus, and it shows the page. Execution of the macro is suspended until the user closes the browser. Works fine for me. Charles |
bert | 29-Jul-2008 15:21 Nothing wrong, however, no possibility for screenpositioning and in case of dynamic generated content of your message you have to write to a (temp)file. |
Mary Doyle (DAF) | 29-Jul-2008 16:20 Hi Bert, You have answered Charles' question perfectly. That is exactly why I was approaching the problem as detailed. I have just tried your 2nd solution. Works perfectly. Thank you very much. Mary |
Mary Doyle | 29-Jul-2008 22:38 Hi Bert and Charles and anyone else that is interested: Just for the record: when I finalised my test macro I substituted ".Document.Body.InnerHTML = "Message test from Cardbox"" with "With .document Example below This is more versatile, or at least it makes it easier to produce a nicely formatted message. Again, thanks for your help and suggestions. Mary Note: The following is just a demo of the possibilities, the message itself is rubbish and at this hour I am not going to replace it with anything else! MessageToShow = "<li><font color=""#993300"" face=""Birch"">Check SAP details</font></li>" &_ Sub ShowMessage(MesssageToShow) Do While (.Busy) '.Document.Body.InnerHTML = "Message test from Cardbox" With .document End With Set objExplorer = Nothing |