Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Activate and make foremost another application

Status
Not open for further replies.

Rick46

Technical User
Sep 25, 2001
14
0
0
US
I have written an HTML page that uses buttons and VBScript to perform functions and link users to other applications and pages. This HTML only runs locally on the network so no server is involved, just the internal network.

Most users also have Outlook up at the same time as running this HTML page. One button causes Outlook to change to a different public folder. Then it activates Outlook to display the new folder location.

My problem is that the Outlook relocation goes just fine. But the AppActivate function is totally erratic. Sometimes it causes Outlook to become the active display window and sometimes it does not. Half the time Outlook just stays minimized on the task bar, or just makes it blink on the taskbar.

Any ideas how to verify and ensure that another application is activated and made foremeost?

Here is the code:

Function CheckOutlook(myFolder)
Dim myOlApp, myForm, WsShell
Set myOlApp = GetObject("","Outlook.Application")
Set myNameSpace = myOlApp.GetNamespace("MAPI")
Set myOLApp.ActiveExplorer.CurrentFolder = myNameSpace.Folders("Public Folders").Folders("All Public Folders").Folders("Principal Financial Group").Folders("Information Services").Folders("IS Data Center").Folders("Physical Planning").Folders("Corp 7 Approved Access")
Set WsShell = CreateObject("WScript.Shell")
WsShell.AppActivate ("Corp 7 Approved Access")
Set WsShell = Nothing
Set MyOLApp = Nothing
Set myNameSpace = Nothing
End Function
 
how about checking the result of the AppActivate method?

Do
intA = intA + 1
If AppActivate(",,,,") = True Then
Exit Do
End If
Wscript.Sleep 1000
If intA = 50 Then
Exit Do
End If
Loop
 
Thanks. But it fails on the "Wscript" object, even when I use the defined "WsShell" object. How do I define the "WScript" object so the Sleep method works?
 
not about the limitations of wscript from a webpage. is this asp we are talking about?
perhaps you can get away without the wscript.sleep? might nick 100% cpu though
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top