LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
printing problems Kim2900 Charts and Charting in Excel 3 December 2nd 09 02:31 PM
Printing problems Bigredno8 Excel Discussion (Misc queries) 4 April 9th 06 04:06 AM
Printing Problems Craig Damons Excel Discussion (Misc queries) 1 November 29th 05 05:04 PM
printing problems Big Buck 31 Excel Worksheet Functions 1 September 12th 05 04:41 PM
Help with printing problems? C. P. Excel Discussion (Misc queries) 3 February 22nd 05 02:55 AM


All times are GMT +1. The time now is 09:13 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"