open a word document

  • Thread starter geert.van.ransbeeck
  • Start date
G

geert.van.ransbeeck

hello
this should be the code to open a new word document from a button in
access
I am in access 2003.
Does anybody has an idea why don't get a response?

Set appWord = GetObject(, “Word.Application”)
Set doc = appWord.Documents.Add
 
D

Douglas J. Steele

Try issuing

appWord.Visible = True

after your Set doc line.



--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


hello
this should be the code to open a new word document from a button in
access
I am in access 2003.
Does anybody has an idea why don't get a response?

Set appWord = GetObject(, “Word.Application”)
Set doc = appWord.Documents.Add
 
G

geert.van.ransbeeck

And when I want to open an existing word doc, should the syntax be
like this?

Set appWord = GetObject("x:\travel\mydocument.doc",
“Word.Application”)
Set doc = appWord.Documents.Add
appWord.Visible = True

quite not that?
 
J

Jim Burke in Novi

Try this...

Set appWord = GetObject(, “Word.Applicationâ€)
Set doc = appWord.Documents.Open("x:\travel\mydocument.doc")
 
G

geert.van.ransbeeck

Thanks

It works, but only if Word is allready open. Is there a solution to
open the word document even if the Word application isn't?

Kind regards
Geert
 
R

RoyVidar

Thanks

It works, but only if Word is allready open. Is there a solution to
open the word document even if the Word application isn't?

Kind regards
Geert

I like using something along the lines of the following (air code)

On Error Resume Next
Set appWord = GetObject(, "Word.Application")
If Err.Number <> 0 Then
' Presumably, Word wasn't open
' The Err.Number to check, if you wish/need, is 429
Err.Clear
' Creating new instance
Set appWord = CreateObject("Word.Application")
If Err.Number <> 0 Then
' Is Word installed?
Err.Clear
Set appWord = Nothing
Exit Sub
End If
End If
On Error Goto <Your error handler>
Set doc = appWord.Documents.Open("x:\travel\mydocument.doc")
 
G

geert.van.ransbeeck

thanks Roy-Vidar

And how can I generate a mail which permits me to get the same word-
doc into an out outlook 2003 - mail as an attachement?

kind regards
geert
 
R

RoyVidar

thanks Roy-Vidar

And how can I generate a mail which permits me to get the same word-
doc into an out outlook 2003 - mail as an attachement?

kind regards
geert

I'ts so long since I've done anything like that, so I think it would
be wiser if someone else looks at that.

Perhaps post a new thread?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top