Mike_Stevens
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.Applica tion")
Set objApp = GetObject(, "Word.Application")
ElseIf UCase(Right(sPath, 4)) = ".xls" Then
Set objApp = CreateObject("Excel.Applic ation")
Set objApp = GetObject(, "excel.Application")
End If
objApp.Visible = True
objApp
Set objDoc = objApp.Documents.Open(sPat h)
sPath = Me.SSOleDBGrid3.Columns(1)
If UCase(Right(sPath, 4)) = ".DOC" Then
Set objApp = CreateObject("Word.Applica
Set objApp = GetObject(, "Word.Application")
ElseIf UCase(Right(sPath, 4)) = ".xls" Then
Set objApp = CreateObject("Excel.Applic
Set objApp = GetObject(, "excel.Application")
End If
objApp.Visible = True
objApp
Set objDoc = objApp.Documents.Open(sPat
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.