Open Existing Word Document From Excel?
Open Existing Word Document From Excel?
(OP)
I would like to open an existing word document using a command button click. I am new to VBA and have been guessing my way around to this point, this is a bit tougher for me. I am wanting to open the word document and merge data from excel, so a fully automated open and merge sequence would be great if possible.





RE: Open Existing Word Document From Excel?
Good Luck
TTFN
Sub LT7()
'
' Lowtran7 macro to paste Lowtran transmission results into Excel Spreadsheet
' Macro recorded 1/23/98 by mei
'
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dim ColIndex, RowIndex, StartRow, Done
Dim FileName, SheetName
Dim WordApp As Object
Dim Trans As String
Set WordApp = GetObject(, "word.application")
FileName = ActiveWorkbook.Name
SheetName = ActiveSheet.Name
Sheets(SheetName).Select
Done = False
ColIndex = ActiveCell.Column
RowIndex = ActiveCell.Row
StartRow = RowIndex
Cells(RowIndex, ColIndex).Select
With WordApp.Selection.Find
.Text = "transmittance ="
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
For Index = 1 To 25
WordApp.Selection.Find.ClearFormatting
WordApp.Selection.Find.Execute
WordApp.Selection.MoveRight unit:=wdCharacter, Count:=1
WordApp.Selection.MoveRight unit:=wdSentence, Count:=1, Extend:=wdExtend
' WordApp.Selection.Copy
Trans = WordApp.Selection.Text
WordApp.Selection.MoveDown unit:=wdLine
Cells(RowIndex, ColIndex).Select
' ActiveSheet.Paste
ActiveCell.Formula = Trans
RowIndex = RowIndex + 1
Next
Cells(StartRow, ColIndex).Select
End Sub