Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

MS Access froms creating Word Docs

  • 10-06-2009 9:28pm
    #1
    Registered Users, Registered Users 2 Posts: 1,086 ✭✭✭


    Just wondering is it possible to code forms and buttons in forms in MS Access to create word document files from a template?

    I reckon it must be possible, do you have to create macros?


Comments

  • Registered Users, Registered Users 2 Posts: 197 ✭✭cracker


    You can certainly do it using VBA. You just need to enable the MS Word object library and it will give you access to all the methods and properties that you need.
    Open up the vba editor and choose tools -> references and then select the Microsoft Word Object library (version 11 is word 2003 I think). Then start coding. Something like this. The Documents.add method allows you to specify a template.
    Public Sub test()
    
        Dim wordApp As New Word.Application
        
        wordApp.Visible = True
        
        
        
        Dim objDoc As Word.Document
        
        Set objDoc = wordApp.Documents.Add
        
        
        objDoc.Save
        
        objDoc.Close
        
        wordApp.Quit
        
        Set objDoc = Nothing
        Set wordApp = Nothing
        
    End Sub
    


Advertisement