-
1
- #1
mkasson
Programmer
- Jan 3, 2004
- 36
Tek-Tips has been very helpful to me over the last few days, so (in addition to Supporting Tek-Tips) I am enclosing below a snippet that we find useful to perhaps help the people that actually provide the answers. While you won't find this code novel or challenging, hopefully you'll find it useful as a professional.
We use Outlook extensively. While Outlook can connect to WinFax we also sometimes need a printed fax cover page under which to fax a hard copy of something. It's also sluggish and we don't love WinFax's cover pages.
I set up a new toolbar for the Contact form and put in a button titled "Fax Cover Page". That button runs this macro.
Real short and sweet: It opens a Word template fax cover page and plugs in the the currently displayed contact's info. The Word template needs to have the three bookmarks for the contact's info.
We have a similarly coded button to a open letter using our "soft" letterhead.
We intend to set up a more sophisticated macro to allow the selection of multiple recipients with an appropriately redesigned cover page.
Enjoy!
- MSK
- MSK
We use Outlook extensively. While Outlook can connect to WinFax we also sometimes need a printed fax cover page under which to fax a hard copy of something. It's also sluggish and we don't love WinFax's cover pages.
I set up a new toolbar for the Contact form and put in a button titled "Fax Cover Page". That button runs this macro.
Real short and sweet: It opens a Word template fax cover page and plugs in the the currently displayed contact's info. The Word template needs to have the three bookmarks for the contact's info.
We have a similarly coded button to a open letter using our "soft" letterhead.
We intend to set up a more sophisticated macro to allow the selection of multiple recipients with an appropriately redesigned cover page.
Enjoy!
- MSK
Code:
Sub FaxCoverSheet()
Dim Wrd As Object
On Error Resume Next ' Defer error trapping.
Set Wrd = GetObject(, "Word.Application")
If Err.Number = 429 Then
Err.Clear
Set Wrd = CreateObject("Word.Application")
ElseIf Err.Number <> 0 Then
MsgBox Err.Description
Exit Sub
End If
On Error GoTo 0
Wrd.Visible = True
Wrd.Documents.Add Template:="faxcover.dot", NewTemplate:=False
Wrd.activedocument.bookmarks("PersonName").Range.Text = Me.Inspectors.Item(1).CurrentItem.FullName
Wrd.activedocument.bookmarks("FaxNum").Range.Text = Me.Inspectors.Item(1).CurrentItem.BusinessFaxNumber
Wrd.activedocument.bookmarks("CompanyName").Range.Text = Me.Inspectors.Item(1).CurrentItem.CompanyName
End Sub
- MSK