Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help - Alt-E hotkey does not work in MSOffice apps, no prob in other apps Bob Newheart Excel Discussion (Misc queries) 4 July 28th 08 03:57 PM
Handling Excel Apps? andy. Excel Programming 1 July 25th 03 04:51 AM
Switching to other apps while running macros in excel 97 Jon Peltier[_3_] Excel Programming 2 July 11th 03 10:49 PM
Linking to other VB apps Keith Willshaw Excel Programming 0 July 10th 03 02:58 PM
Linking to other VB apps Steve Andrews[_2_] Excel Programming 0 July 10th 03 02:25 PM


All times are GMT +1. The time now is 04:12 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"