View Single Post
 
Old 11-18-2016, 12:22 PM
Sven62 Sven62 is offline Windows 7 64bit Office 2010 32bit
Novice
 
Join Date: Nov 2016
Posts: 4
Sven62 is on a distinguished road
Default Make read only and being to top

The code below opens the file as read only.

How can I make it also bring that Word doc to the top? Right now it opens behind the excel file where my form button resides.

Code:
Sub OpenWord() 
    Dim WordApp As Object 
    Dim WordDoc As Object 
     
    Set WordApp = CreateObject("Word.Application") 
    Set WordDoc = WordApp.Documents.Open(Filename:="C:\test\test.doc", ReadOnly:=True) 
    WordApp.Visible = True 
     
     'do your stuff
     
    Set WordDoc = Nothing 
    Set WordApp = Nothing 
End Sub
Reply With Quote