Results 1 to 8 of 8
  1. #1
    Lounger
    Join Date
    Jun 2001
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Formatted Output for Use in Word or Outlook (2000 9.0 SR-1)

    We have been talking about the default properties of tables in Ms. Word. We talked about the use to which I have been putting the output of the copy routine in Ms. Access. The gentle person from the Word Board says that I should ask Y'all about having Ms. Access print a formatted record into Ms. Word for further editing, or for use directly into a message in Ms. Outlook.

    Please have a look at the thread and let me and he know the solution.

    The thread reference is <A target="_blank" HREF=http://www.wopr.com/cgi-bin/w3t/showflat.pl?Cat=&Board=wrd&Number=116480
    >http://www.wopr.com/cgi-bin/w3t/showflat.p...d&Number=116480
    </A>

  2. #2
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,624
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Formatted Output for Use in Word or Outlook (2000 9.0 SR-1)

    Yes, it's quite possible to get information from Access and put it into a Word document. You are using a copy and paste approach at the moment, but I would suggest you look at OLE Automation. Access can work as either client or a server. The code to do things from Word appears to be somewhat more complex than running Word code in Access. The Access Developers Handbook by Getz et. al. (version 97 chapt 20 - our 2000 version is on loan to someone's home library so I can't give you the chapter in it) has a detailed example of how to build a Word document from Access that is too complex to try to reproduce here, but would be a good place to start. It also has an Excel example of pulling data from Access into Excel in Chapter 21 that parallels what you would want to do when pulling it from Word. If you are familiar with the Word object model, you may find it easier to do Word code in Access rather than Access code in Word. In any event, you need to have a process to find the data you want in the database, so it might make sense to do things in Access from the get-go. Hope this helps some.
    Wendell

  3. #3
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Formatted Output for Use in Word or Outlook (2000 9.0 SR-1)

    Hi,
    One quick question - do you actually need the interim Word process or do you simply want to put the information into Outlook? If it's the latter, then something like:
    <pre>Private Sub cmdMailIt_Click()
    Dim appOutlook As Outlook.Application, fdrInbox As Outlook.MAPIFolder
    Dim itmNewMail As Outlook.MailItem, nspMAPI As Outlook.NameSpace
    Set appOutlook = New Outlook.Application
    Set nspMAPI = appOutlook.GetNamespace("MAPI")
    Set fdrInbox = nspMAPI.GetDefaultFolder(olFolderInbox)
    Set itmNewMail = fdrInbox.Items.Add(olMailItem)
    With itmNewMail
    .To = "Whoever"
    .Body = .Body & vbCrLf & "Field description:" & vbTab & Me!FieldNamehere & vbCrLf
    .Display
    End With
    Set itmNewMail = Nothing
    Set fdrInbox = Nothing
    Set nspMAPI = Nothing
    Set appOutlook = Nothing
    End Sub
    </pre>

    ought to get you started. You will need to set a reference to the Outlook 9.0 object library in your Access database.
    Hope that helps.
    PS If you do need the Word step in the middle, you ought to be able to use something similar to put specific data into a Word table which you have previously set up.
    Regards,
    Rory

    Microsoft MVP - Excel

  4. #4
    Lounger
    Join Date
    Jun 2001
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Formatted Output for Use in Word or Outlook (2000 9.0 SR-1)

    In your prompt response you mentioned ".. You will need to set a reference to the Outlook 9.0 object library in your Access database. ..." I think that our local guru can point the way. Either way I will give it a try.

    As to using Ms. Word: 'They' do not want to mess with a "mustang" database. So, I use that file as a record that is more easily accessable to our users (they understand from .doc, don't ya know). Will tinker some more and let you know.

    Thanks again.

  5. #5
    Lounger
    Join Date
    Jun 2001
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Formatted Output for Use in Word or Outlook (2000 9.0 SR-1)

    Thanks to you also: OLE Automation is something with which I am not familiar. It will take a while to get hold of the book; hence, my trying Rory's approach first. [Ole! Here I thought that that had to do with a style of dancing].

    Thanks again,

  6. #6
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Formatted Output for Use in Word or Outlook (2000 9.0 SR-1)

    FWIW, my method is using OLE automation, it's just automating Outlook rather than Word.
    Regards,
    Rory

    Microsoft MVP - Excel

  7. #7
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Formatted Output for Use in Word or Outlook (2000 9.0 SR-1)

    Have a look at <A target="_blank" HREF=http://www.helenfeddema.com/CodeSamples.htm>Helen Feddema's site</A>.
    There are samples witch you can use as start.
    For the reference, open a module in design view, Click Tools | References in in the list scroll to Microsoft Outlook 9.0 Object Library, check it.
    Francois

  8. #8
    Lounger
    Join Date
    Jun 2001
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Formatted Output for Use in Word or Outlook (2000 9.0 SR-1)

    thanks to all, Francois, et al. Looks like I will be busy over the weekend.

Posting Permissions

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