View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
[email protected] aidan.heritage@virgin.net is offline
external usenet poster
 
Posts: 244
Default Office Automation

On May 27, 10:36*am, Vijay Chary
wrote:
Hi !! :)

* * * * * * I need some information on controlling MS Word with a Macro in
MS Excel and vice-versa.

* * * * * Could someone give me detailed instructions, please !! :)

* * * * * *Thanks in advance !

* * * * * * * * * *Vijay


You don't say what you want either to do to the other, but

Dim WrdHold As String
Dim appwd As Object
On Error GoTo notloaded
Set appwd = GetObject(, "Word.Application")
notloaded:
If Err.Number = 429 Then
Set appwd = CreateObject("Word.Application")
End If
appwd.Visible = True
On Error GoTo 0


would give you a Word Object - you can then program this as with any
other object - for instance, to add a new document based on a
template

appwd.documents.Add Template:="Q:\APPS\StevApps\SystTemp\emulation
\Change of address.dot"

(this comes from a real word example). In the same way, you can
create an excel object and interface that.