View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.word.vba.beginners
Mike NG Mike NG is offline
external usenet poster
 
Posts: 87
Default passing variables from excel to word

If I want to open word from excel using automation like this, is there
any way I can pass two variables across - the only way I can think of at
the moment is to use a file in between with the values in!

Sub OpenWord()

Dim oDoc As Word.Document
Dim oWord As Word.Application


'See if word's already running
On Error Resume Next
Set oWord = GetObject(, "Word.Application")
If Err Then
'No, so start a new word session
Set oWord = New Word.Application
Err.Clear
End If

oWord.Visible = True
oWord.Activate
Set oDoc = oWord.Documents.Open(ThisWorkbook.Path & "\Envelope.doc")
--
Mike