Opening Word Ducuments From Excel Macro

D

DB100

Hi all

I am seriously hoping someone can help.

I have created a Userform, which accesses a hidden sheet and dependin
on the selection runs a formula from the sheet and opens a relevan
spreadsheet...

But...........

I have now adapted this to open another set of files, but these ar
.doc and therefore won't open.

I have used the below to open Excel files and works fine. I am hopin
someone can help adapt it to a word document.

Thanks guys

David

Private Sub CmdOPEN_Click()
Worksheets("SHEET1").Range("a2").Value = cm1
megafile = Worksheets("SHEET1").Range("A1").Value
Windows("OPEN INFO.xls").Visible = False
Application.ScreenUpdating = True
Workbooks.Open megafile, False, True
Unload Me
End Su
 
E

Ed

I have code with a button in my workbook that grabs the value of a cell for
the Word doc name and opens it. You should be able to adapt it.

HTH
Ed

Sub FindDoc()

Dim WD As Object
Dim doc As String
Dim Fname As String
Dim Fpath As String

' Get file path
Fpath = ThisWorkbook.Path

' Check if ActiveCell is in Col C
Sheets("Sheet1").Activate
If ActiveCell.Column = 3 Then

' Get doc number from list page
Fname = ActiveCell.Text

' Open doc
doc = Fpath & "\" & Fname & ".doc"
Set WD = CreateObject("Word.Application")
WD.Documents.Open doc
WD.Visible = True

Else
MsgBox "Please select a doc number in Column C using a single mouse
click."

End If

End Sub
 
Top