How to save/export my formatted report from Access-DB to Word-File?
hi, all!
It's a simple question. I'm sorry, but I couldn'd find an answer in this forum:(
I have formatted several nice reports.
Could you be so kind to help me in VBA to save/export for example my Report1 from DB1.mdb to Report.DOC (I need to save format of pages too: fonts, colors, footers, etc...).
Code/example would be very much appreciated :wave:
thanks in advance!
kind regards.
Baloo.
Re: How to save/export my formatted report from Access-DB to Word-File?
In Access, Tools > Office Links > Publish It with Microsoft Office Word.
Re: How to save/export my formatted report from Access-DB to Word-File?
hi RobDog,
thanks a lot, but I need to do it in Access VBA programmatically.
could you be so kind to show me VBA-code?
kind regards,
Baloo.
Re: How to save/export my formatted report from Access-DB to Word-File?
You can use Application.DoCmd.RunCommand acCmdOutputToRTF after your report is opened.
Re: How to save/export my formatted report from Access-DB to Word-File?
hi,
RobDog888, thanks a lot once more! but I have three more questions:)
I've used:
VB Code:
DoCmd.OutputTo acReport,"repMyReport", acFormatRTF, "C:\MyDoc.doc", False
and it works, but in this case: Word can't save all formats of my report fields:( /colors of fields from Detail-region/ That's why I have to use - acCmdOutputToRTF
also about -
VB Code:
Application.DoCmd.RunCommand acCmdOutputToRTF
1) how to save my Report in the definite path, for example "C:\MyReport.DOC"? Unfortunately I can't use reference to MS-Word, because my each user have different Word-version:(
2) and can I do it in general without opening Word-application?
3) it displays the Database Window which I want to keep hidden from the users?
Any help or hints would be most appreciated:)
kind regards,
Baloo.
Re: How to save/export my formatted report from Access-DB to Word-File?
You can use Late Binding to accomodate multiple versions of Word.
When using RunCommand acCmdOutputToRTF you can not specify a directory path via code.
So basically you want to output a Word report without Access being visible and how about Word?