Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
OLE switching <- Apps
I have some code to open a program. The problem is that when the
applicaton opens it becomes the active window. I need to have Excel as the active window when the Sub is finished. How can I do this? Lance Sub Openfile() Dim Varlist As String 'OPEN DIALOG BOX TO OPEN SPSSFILE OFile = Application.GetOpenFilename("SPSS Datafile, *.sav") 'USE OLE TO OPEN SPSS Set oApp = CreateObject("SPSS.Application") Set oDoc = oApp.OpenDataDoc(OFile) oDoc.Visible = True 'Another way to open file 'sCommands = "GET FILE = ' " & OFile & " ' " 'oApp.ExecuteCommands sCommands, True 'USE OLE TO OPEN OUTPUT DOC Set oOut = oApp.NewOutputDoc oOut.Visible = True End Sub |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
OLE switching <- Apps
End your code with:
AppActivate "Microsoft Excel" This will make Excel the active window (note: for more specificity, e.g. if you have multiple Excel sessions open, you may want to duplicate the exact title bar text from your excel session). -----Original Message----- I have some code to open a program. The problem is that when the applicaton opens it becomes the active window. I need to have Excel as the active window when the Sub is finished. How can I do this? Lance Sub Openfile() Dim Varlist As String 'OPEN DIALOG BOX TO OPEN SPSSFILE OFile = Application.GetOpenFilename("SPSS Datafile, *.sav") 'USE OLE TO OPEN SPSS Set oApp = CreateObject("SPSS.Application") Set oDoc = oApp.OpenDataDoc(OFile) oDoc.Visible = True 'Another way to open file 'sCommands = "GET FILE = ' " & OFile & " ' " 'oApp.ExecuteCommands sCommands, True 'USE OLE TO OPEN OUTPUT DOC Set oOut = oApp.NewOutputDoc oOut.Visible = True End Sub . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Help - Alt-E hotkey does not work in MSOffice apps, no prob in other apps | Excel Discussion (Misc queries) | |||
Handling Excel Apps? | Excel Programming | |||
Switching to other apps while running macros in excel 97 | Excel Programming | |||
Linking to other VB apps | Excel Programming | |||
Linking to other VB apps | Excel Programming |