Link to home
Start Free TrialLog in
Avatar of Mike_Stevens
Mike_StevensFlag for United States of America

asked on

Using automation from within VB App

I am using the following code to open a Word document from within my VB6 application.  This code works fine but sometimes when Word is loaded and the docment is displayed it is either minimized, behind my VB app or in front of the VB app.  Is their any way to force word to be opened normal and having the focus?                
               
                sPath = Me.SSOleDBGrid3.Columns(1).Text
               
                If UCase(Right(sPath, 4)) = ".DOC" Then
                    Set objApp = CreateObject("Word.Application")
                    Set objApp = GetObject(, "Word.Application")
                ElseIf UCase(Right(sPath, 4)) = ".xls" Then
                    Set objApp = CreateObject("Excel.Application")
                    Set objApp = GetObject(, "excel.Application")
                End If
               
                objApp.Visible = True
                objApp

                Set objDoc = objApp.Documents.Open(sPath)
ASKER CERTIFIED SOLUTION
Avatar of David Lee
David Lee
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial