ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Problems printing using ExecWB (https://www.excelbanter.com/excel-programming/342111-problems-printing-using-execwb.html)

DanAdams

Problems printing using ExecWB
 

*Situation*: I have a VBA macro in Outlook that should save all email
attachments of messages in a specific mail folder to a directory on the
disk, then open and print each file using ExecWB. It is important that
each file is printed *without confirmation*, sinec there will commonly
be several hundred attachment files to be printed,

*Problem*: The files are saved to disk fine, but I get an error from
the code that should print the attachments.

*Error message*: 'dialogArguments.__IE_PrintType' is null or not an
object

*Full code*:

I have highlighted in red the apparently troublesome piece of code.

<CODE
Sub ReceiptPrint()
Dim oApp As Application
Dim oNS As NameSpace
Dim oMsg As Object
Dim oAttachments As Outlook.Attachments
Dim strControl
Dim filenameAndPath

Set oApp = New Outlook.Application
Set oNS = oApp.GetNamespace("MAPI")
Set oFolder = oNS.GetDefaultFolder(olFolderInbox)
strControl = 0
filenameAndPath = ""

Dim folder As String
folder = InputBox("Enter reporting date (eg 29-09-05)", "Enter Date
Name")
MkDir "P:\Volume Licensing Operations Team\Monthly Orders\Microsoft
Reporting\MS Receipts\" & folder

For Each oMsg In oFolder.Items
With oMsg
If .SenderEmailAddress = " Then
strControl = strControl + 1
filenameAndPath = "P:\Volume Licensing Operations
Team\Monthly Orders\Microsoft Reporting\MS Receipts\" & folder & "\" &
folder & "-" & "receipt" & strControl & ".htm"
oMsg.Attachments.Item(1).SaveAsFile filenameAndPath
PrintReceipt (filenameAndPath)
End If
End With
Next

MsgBox "All receipts have now been saved to P:\Volume Licensing
Operations Team\Monthly Orders\Microsoft Reporting\MS Receipts. Macro
will atempt to print these now."

End Sub


Sub PrintReceipt(fFullPath As String)

Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = False
IE.Navigate ("file:///" & fFullPath)

IE.ExecWB 6, 2

IE.Quit

Set IE = Nothing

End Sub
</CODE

Can anyone help?

Many Thanks

Dan


--
DanAdams
------------------------------------------------------------------------
DanAdams's Profile: http://www.excelforum.com/member.php...o&userid=27881
View this thread: http://www.excelforum.com/showthread...hreadid=473864


DanAdams[_2_]

Problems printing using ExecWB
 

bump for some help please


--
DanAdams
------------------------------------------------------------------------
DanAdams's Profile: http://www.excelforum.com/member.php...o&userid=27881
View this thread: http://www.excelforum.com/showthread...hreadid=473864


DanAdams[_3_]

Problems printing using ExecWB
 

bump for some help pleas

--
DanAdam
-----------------------------------------------------------------------
DanAdams's Profile: http://www.excelforum.com/member.php...fo&userid=2788
View this thread: http://www.excelforum.com/showthread.php?threadid=47386


DanAdams[_4_]

Problems printing using ExecWB
 

bump for some help please


--
DanAdams
------------------------------------------------------------------------
DanAdams's Profile: http://www.excelforum.com/member.php...o&userid=27881
View this thread: http://www.excelforum.com/showthread...hreadid=473864


DanAdams[_5_]

Problems printing using ExecWB
 

bump for some help pleas

--
DanAdam
-----------------------------------------------------------------------
DanAdams's Profile: http://www.excelforum.com/member.php...fo&userid=2788
View this thread: http://www.excelforum.com/showthread.php?threadid=47386


DanAdams[_6_]

Problems printing using ExecWB
 

bump for some help please


--
DanAdams
------------------------------------------------------------------------
DanAdams's Profile: http://www.excelforum.com/member.php...o&userid=27881
View this thread: http://www.excelforum.com/showthread...hreadid=473864


DanAdams[_7_]

Problems printing using ExecWB
 

bump for some help please


--
DanAdams
------------------------------------------------------------------------
DanAdams's Profile: http://www.excelforum.com/member.php...o&userid=27881
View this thread: http://www.excelforum.com/showthread...hreadid=473864



All times are GMT +1. The time now is 02:45 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com