Open Winword-file using a Excel 97 VBA macro

  • Thread starter Thread starter Dominik Scheck
  • Start date Start date
D

Dominik Scheck

Hi,
I am working with Excel 97 and would like to open a
specific Word 97 .doc file with a macro. Does anybody have
know how to do that? (actually I know how to do it with
Excel 2000 but not with Excel 97...)
Thank you very much
Dominik
 
Should not be any significant difference between how you do it in xl2000 and
how you do it in xl97. Assume you are using either automation or shell.

Regards,
Tom Ogilvy
 
Hello Tom, thanks for your answer:
I have got the following code but it does not run under
Excel 97 (gives me: User-defined type not defined!!):

Dim obwrd As Object
Set obwrd = CreateObject("word.application")

Dim obwrd As Word.Application
Set obword = New Word.Application

obword.documents.Open ThisWorkbook.Path & "\\szrh101
\biam\Bond\Euro\Euro Corp\Miss Daisy\Help\" & Daisy.dco
obword.Visible = True

Can you help me with shell? I have tried it but i could
not manage....
Thank you very much!!!!
Dominik
 
Dominik:

I open a Word document from within an Excel macro using Word2000,
Excel2000, in Win2000, with

Dim Word As New Word.Application
Dim WordDoc As New Word.Document
Dim Doc As String

Doc = "C:\Documents and Settings\emillis\Desktop\File Paths.doc"
Set WordDoc = Word.Documents.Open(Doc)

One of the things that kept giving me errors was that I had neglected to
reference Word objects.

HTH
Ed
 
You don't need both createobject and new. If you use new you need to have a
reference to the word object library, so createobject might be more
flexible:

Dim obwrd As Object
Set obwrd = CreateObject("word.application")

obword.documents.Open ThisWorkbook.Path & "\\szrh101" & _
"\biam\Bond\Euro\Euro Corp\Miss Daisy\Help\Daisy.doc"
obword.Visible = True

Note that the extension in your sample was dco rather than doc


Should work.

Regards,
Tom Ogilvy
 
Back
Top