Results 1 to 6 of 6

Thread: How to save/export my formatted report from Access-DB to Word-File?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Dec 2005
    Posts
    26

    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

    thanks in advance!
    kind regards.
    Baloo.
    Last edited by Baloo; Mar 26th, 2006 at 11:35 AM.

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Dec 2005
    Posts
    26

    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.
    Last edited by Baloo; Mar 27th, 2006 at 01:32 AM.

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Dec 2005
    Posts
    26

    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:
    1. 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:
    1. 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.
    Last edited by Baloo; Apr 4th, 2006 at 08:53 AM.

  6. #6
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width