Printing outlook forms in word

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • belinda
    New Member
    • May 2007
    • 1

    Printing outlook forms in word

    I have used the ff command but only get the date printout and have no clue whats wrong:

    'Printing function
    ' - opening a Word template with bookmarks
    ' - read bookmarks list from template and match with the field names in Outlook form
    ' - value in form is that populated to the Word doc for auto-printing
    ' - prompt user for closing Word when printing is done.
    ' - Save word as C:\deletme.doc before exiting Word.
    ' 8/21/98 Leng Ho
    ' 9/16/98 modified to include remove save C:\deletme.doc function
    ' remove visibility of Word
    ' correct problem by using Item.UserProper ties.find(strFi eld).value
    '

    Dim strTemplate
    Dim objWord
    Dim objDocs
    Dim PageRange
    Dim strField
    Dim strField1


    Sub cmdPrint_Click

    Set objWord = CreateObject("W ord.Application ")

    ' Put the name of your Word template that contains the bookmarks
    strTemplate = "Facility Request.dot"

    ' Location of Word template; could be on a shared LAN
    'strTemplate = "C:\Documen ts and Settings\Belind am\My Documents\Outlo ok\" & strTemplate
    strTemplate = "C:\Documen ts and Settings\Belind am\My Documents\TEST. doc"


    Set objDocs = objWord.Documen ts
    objDocs.Add strTemplate
    set mybklist = objWord.ActiveD ocument.Bookmar ks


    'NB!! Not best practice - for testing

    'Set the bookmarks
    objWord.ActiveD ocument.Bookmar ks("Date").Rang e.text = date
    objWord.ActiveD ocument.Bookmar ks("Department" ).Range.text = department
    objWord.ActiveD ocument.Bookmar ks("Request").R ange.text = request
    objWord.ActiveD ocument.Bookmar ks("Priority"). Range.text = Priority
    objWord.ActiveD ocument.Bookmar ks("Requester") .Range.text = requester
    objWord.ActiveD ocument.Bookmar ks("TelNo").Ran ge.text = telNo
    objWord.ActiveD ocument.Bookmar ks("Deadline"). Range.text = DeadLineDate


    objWord.PrintOu t Background = True
    objWord.Quit(0)
    End Sub
  • MMcCarthy
    Recognized Expert MVP
    • Aug 2006
    • 14387

    #2
    I'm moving this to the Visual Basic forum.

    Technical questions are not allowed in the cafe.

    ADMIN

    Comment

    Working...