Re: coding question
- From: Lord Kelvan <the_iddiot@xxxxxxxxxxx>
- Date: Sun, 7 Sep 2008 17:54:50 -0700 (PDT)
you have to set up an application reference not just a doc reference
'creates a new object which will be the word application
Dim objword As New word.Application
'activates the object
Set objword = CreateObject("word.Application")
'opens the document
objword.documents.Open "C:\Documents and Settings\WinXP\Desktop
\docname.doc"
'displays the application for use
objword.Visible = True
'will minimise the word application
objword.WindowState = wdWindowStateMinimize
'will close the application
objword.quit
as a note to use this you will have to reference the word library in
the code references
to do this
click on tool --> references
then scroll down to find
microsoft word X.X object library
where X.X is the version of word you use
ie
8.0 is word 97
9.0 is word 2000
10.0 is word 2002
11.0 is word 2003
12.0 is word 2007
remember any code you do in your vba in access which is needed to do
somethign in word you need to reference objword before it at all
times.
this can also be done for any of the office applications and cna be
quite useful for manipluating application as an example i use this
from word to generate an automatic report which my code in word opens
access and excel to gather and process information then saves the
results into microsoft word for use in a report.
hope this helps
Regards
Kelvan
.
- References:
- coding question
- From: atlantis43 via AccessMonster.com
- coding question
- Prev by Date: Verifying data is in a field before exit or close
- Next by Date: Re: Verifying data is in a field before exit or close
- Previous by thread: coding question
- Next by thread: highlight fields when form loads
- Index(es):
Relevant Pages
|