Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Faxing Impromptu Reports from WinFax Pro

Status
Not open for further replies.

smartglass

IS-IT--Management
Mar 14, 2006
33
GB
Hi:
I have some great help in preparing a macro to fax reports to customers and am trying to follow drlex's advice to avoid send keys. I know Impromptu and Winfax are both OLE complaint but cannot get even a basic fax to go.
Is anybody familiar with OLE automation between these 2 products?
Here is my sample code:
Sub main()
Dim Winfax as Object
Set WinFax = CreateObject("WinFax.SDKSend")
Winfax.ShowSendScreen(1)
WinFax.SetSubject("test")
WinFax.SetNumber("123456")
WinFax.SetTo("ABC Company")
WinFax.SetPrintFromApp(1)
WinFax.AddAttachmentFile("test.pdf")
WinFax.SetCoverText(" ")
WinFax.SetQuickCover(0)
Winfax.ShowCallProgress(1)
WinFax.Send(0)
end sub
Do I need to activate the application?
Thanks!
 
I'm not familiar with WinFax, but a logical observation would be that 'WinFax.Send(1)' for 'WinFax.Send(0)' would seem a reasonable change.

soi la, soi carré
 
That was a pure simpsons "D'oh" moment! Thanks.
I had in fact already fixed that, still without any success; but if anybody there does know Winfax I would be very grateful!
Thanks again
 
Thanks to Griffindm and drlex for their help; I have now written a macro that creates a report that lists those customers who require an order acknowledgement, populate a second report with each of those customers in turn, generate a pdf for each and fax each customer his report via winfax.
I enclose the code to help others; I am sure the experts can find fault but it does work!
i=customer code, N=Name, F=Fax number
Thanks again.

Option Explicit
Sub Main()

Dim ImpApp as Object
Dim ImpCat as Object
Dim ImpRep as Object
Dim ImpRep1 as Object
Dim objPDFPub as Object
Dim strReportPath As String
Dim Month
Dim Months As String
Dim msgtext
Dim returnValue as String
Dim total as Integer
Dim R As String
rem Dim i as Integer
Dim S as Integer
Dim pdfPub as Object
Dim x as Integer
Dim i(999) as Integer
Dim N(999) as String
Dim Nt AS String
Dim F(999) as String
Dim Ft As String
Dim St as String
Dim Winfax as object


msgtext="Enter a Date :(YYYY-MM-DD)"
Month =InputBox$(msgtext, "Date Selector",1)
Months = Format(Month,"YYYY-MM-DD")


Set ImpApp = CreateObject("CognosImpromptu.Application")
ImpApp.OpenCatalog "R:\Impromptu\XXXX.cat","User",,"XXX","XXX"
Set ImpCat = ImpApp.ActiveCatalog
ImpApp.Visible True

Set ImpRep1 = ImpApp.OpenReport("R:\Impromptu\pdf\Acknowledge\report1.imr")
total = ImpRep1.GetDatavalue(6,1)
For x = 1 to total
i(x) = ImpRep1.GetDatavalue(1,x)
N(x) = ImpRep1.GetDatavalue(3,x)
F(x) = ImpRep1.GetDatavalue(4,x)
Next x
ImpRep1.CloseReport
Set ImpRep1 = Nothing

For x = 1 to total
S = i(x)
Nt = N(x)
Ft = F(x)
St = Format$(S,)
Set ImpRep = ImpApp.OpenReport("R:\Impromptu\acknowledgmentspdf.imr", Months+"|"+ St)
strReportPath = "R:\Impromptu\pdf\Acknowledge\"
Set PDFPub = ImpRep.PublishPDF
PDFPub.Publish strReportPath & S & ".pdf"
Next x
ImpRep.CloseReport
Set ImpRep = Nothing
For x = 1 to total
S = i(x)
Nt = N(x)
Ft = F(x)
St = Format$(S,)
Set WinFax = CreateObject("Winfax.SDKSend8.0")
Winfax.SetSubject("acknowledgement")
WinFax.SetTo (Nt)
WinFax.SetNumber(Ft)
WinFax.AddAttachmentFile(strReportPath & S & ".pdf")
WinFax.AddRecipient
WinFax.Send(0)
Next x


ImpApp.Quit
Set ImpApp = Nothing

End Sub
 
Smartglass,

Glad I could help. This looks fine. It may help someone else looking to automate faxing from Impromptu as well.

Thanks for contributing!

Dave Griffin


The Decision Support Group
Reporting Consulting with Cognos BI Tools
Magic with Data [pc2]
Want good answers? Read FAQ401-2487 first!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top