I’ve written a macro in Word (2000) to automate fax sends (Windows2k fax) from my various Word fax templates. This is what I’ve written:
public sub Faxit()
Dim strNumber(2) As String
Dim strStyle(2) as String
strStyle(1) = “FaxNumber”
strStyle(2) = “FaxSubject”
dim x as Integer
Dim thisFax as New FAXCOMLib.FaxServer
Dim FaxtoSend as FAXCOMLib.FaxDoc
For x = 1 to 2
Selection.HomeKey Unit:= wdStory
Selection.Find.Style = ActiveDocument.Styles (strStyle(x))
Selection.Find.Execute
strNumber(x) = Selection
next x
thisFax.Connect “MyModem”
Set FaxtoSend = thisfax.CreateDocument (thisDoc)
with FaxtoSend
.FaxNumber = strNumber(1)
.Send
end with
end sub
The problem is, it doesn’t work. It won’t run the thisFax.Connect line. I’ve inserted the HKLM entry for the modem and just the name of the modem but this is obviously wrong. If I leave the line out then the FaxtoSend.Send line doesn’t work. I’m at a loss as to how to create the right object.
Any ideas out there?
Thanks
Peter