'publish in MS Word' via code?

  • Thread starter Thread starter Jerome
  • Start date Start date
J

Jerome

Hi,

(Working in Access 2000)

Is it possible to open a report directly as RTF in Word or do you always
have to first open the report as a preview and then click 'publish in MS
Word'? Id yes, what would the VB code look like?

Thanks a lot,

Jerome
 
Hi,

Because Access Reports are bound to data they always have to be opened first
to use the latest data.

The following code will output the report called rptTest to a Rtf file and
launch Word:

DoCmd.OutputTo acOutputReport, "rptTest", acFormatRTF, "C:\test.rtf",
True

HTH

--

Cheers
Mark

Free Access/Office Add-Ins at:
http://mphillipson.users.btopenworld.com/
 
If I understand your process correctly, you might
experiment with:
DoCmd.OutputTo acOutputReport, "[The name of your MS
Access report goes in here without the brackets]",
acFormatRTF, "[The name of the rtf output file goes here
without the brackets].rtf", True

The "True" parameter at the end of this command launches
the application associated with .rtf on the user
computer, typically MS Word. This routine will create
a .rtf file, just like clicking the "Publish It To Word"
button does... Note that there are no Filter or Where
conditions here, like you'd see in the "OutputReport"
method of DoCmd. Such conditions would have to be built
into the record source of the report...

TL
 
Back
Top