VBA excel 右传真

VBA excel rightfax

目前我在 Excel 中有一个过程,用户单击特定命令,然后从 Excel 中获取数据并在 Word 中创建邮件合并。然后我想通过 RightFax 将它添加到文件中,但是我在设置 oNewFax 时遇到了麻烦,当逐步执行时我得到一个 运行-time 错误 '-2147023174 (800706ba)':.任何帮助是极大的赞赏!

    Sub RightFax()

Dim oFaxServer As RFCOMAPILib.faxserver
Dim oNewFax As RFCOMAPILib.fax
Set oFaxServer = New RFCOMAPILib.faxserver
oFaxServer.ServerName = "RightFax Fax Printer"
oFaxServer.UseNTAuthentication = True
Set oNewFax = oFaxServer.User.Faxes.Create

oNewFax.ToFaxNumber = "##########"
oNewFax.ToName = "Testing"
oNewFax.EmailSubject = ""
oNewFax.Attachments.Add ("######")
oNewFax.HasCoversheet = False 'Change to true if you want a coversheet 
generated
oNewFax.Send
Set oFaxServer = Nothing
Set oNewFax = Nothing

End Sub

我的工作代码创建了如下所示的传真对象...

Set oNewFax = oFaxServer.CreateObject(coFax)