Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() *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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
printing problems | Charts and Charting in Excel | |||
Printing problems | Excel Discussion (Misc queries) | |||
Printing Problems | Excel Discussion (Misc queries) | |||
printing problems | Excel Worksheet Functions | |||
Help with printing problems? | Excel Discussion (Misc queries) |