• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 250
  • Last Modified:

Creating word doc through outlook form

I have a form in which I also want to create a word document.  I would appreciate any help or pointers to where I could get valuable help to accomplish this.
0
stino
Asked:
stino
  • 3
1 Solution
 
brice123Commented:
What do you really want to do?
- Attach a Word document in a form?
- Generate a Word document using data from an Outlook form?

In the first case, a custom Post form should be sufficient.
In the second case of (a custom Contact form for example), just place a command button and add a similar code :

Function CommandButtonFax_Click()  
      ' --------------------------------------------
      ' Generate a fax document in Microsoft Word 97
      ' --------------------------------------------
      ' --- Create a new instance of word application
      Set objWordApp = Item.Application.CreateObject("Word.Application")

      objWordApp.Visible = True
   
      ' --- Create a new document based on the specified template
      Set objDoc = objWordApp.Documents.Add("h:\tecdoc\templates\fax.dot", False)

      Set olMAPI = Application.GetNameSpace("MAPI")

      ' --- Replace Bookmarks with data from the current item
      objWordApp.Selection.GoTo -1,,,"To"
      objWordApp.Selection.InsertBefore item.FullName
      objWordApp.Selection.GoTo -1,,,"ToAddress"
      objWordApp.Selection.InsertBefore item.BusinessAddress
      objWordApp.Selection.GoTo -1,,,"ToPhone"
      objWordApp.Selection.InsertBefore item.BusinessTelephoneNumber
      objWordApp.Selection.GoTo -1,,,"ToFaxPhone"
      objWordApp.Selection.InsertBefore item.BusinessFaxNumber
      objWordApp.Selection.GoTo -1,,,"From"

      ' --- Get the current Outlook user
      objWordApp.Selection.InsertBefore olMAPI.CurrentUser
      objWordApp.Selection.GoTo -1,,,"Body"

      Set objWordApp = Nothing
End Function
0
 
stinoAuthor Commented:
Option 2 hits the nail on the head.  Can I get an example of the template.

email - acastro@bel.com.bz
0
 
stinoAuthor Commented:
Option 2 hits the nail on the head.  Can I get an example of the template.

email - acastro@bel.com.bz
0
 
stinoAuthor Commented:
I need to find literature on this stuff.  Also, I want to format the email messages that I develop (bold, indent, etc) so If you have any ideas tell me and I'll post the question.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now