barrye8
10-28-2015, 03:52 AM
Hi
I've had a look around the forums but can't find anything.
I found a script on the Internet that auto prints email attachments to your default printer as soon as they arrive. Seemed simple enough and it works. However, now every time I receive an email, regardless if it has an attachment, I get the error : 424 - Object required. The only option I have is to click OK to make the box disappear.
The guide said:
In Outlook, go to Developer tab and click "Visual Basic" button
If you don't have "Developer" tab, go to customize your ribbon/toolbar and add "Developer"
In new window titled "Microsoft Visual Basic for Applications", double-click "ThisOutlookSession" icon in the tree on left side and paste the following script text into the new window on the right:
Sub LSPrint(Item As Outlook.MailItem)
On Error GoTo OError
'detect Temp
Dim oFS As FileSystemObject
Dim sTempFolder As String
Set oFS = New FileSystemObject
'Temporary Folder Path
sTempFolder = oFS.GetSpecialFolder(TemporaryFolder)
'creates a special temp folder
cTmpFld = sTempFolder & "\OETMP" & Format(Now, "yyyymmddhhmmss")
MkDir (cTmpFld)
'save & print
Dim oAtt As Attachment
For Each oAtt In Item.Attachments
FileName = oAtt.FileName
FullFile = cTmpFld & "\" & FileName
'save attachment
oAtt.SaveAsFile (FullFile)
'prints attachment
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.NameSpace(0)
Set objFolderItem = objFolder.ParseName(FullFile)
objFolderItem.InvokeVerbEx ("print")
Next oAtt
'Cleanup
If Not oFS Is Nothing Then Set oFS = Nothing
If Not objFolder Is Nothing Then Set objFolder = Nothing
If Not objFolderItem Is Nothing Then Set objFolderItem = Nothing
If Not objShell Is Nothing Then Set objShell = Nothing
OError:
If Err <> 0 Then
MsgBox Err.Number & " - " & Err.Description
Err.Clear
End If
Exit Sub
End Sub
Go to menu Tools > References and add a reference to "Microsoft Scripting Runtime". Click OK button to close References window.
Hit Save icon on top toolbar and close Visual Basic window.
Create a rule in Outlook for all incoming messages from a certain person (or from who you receive those attachments) and choose run a script action.
I am hoping that someone who knows what they're doing could tell me what needs to be changed.
I'm using it on Outlook 2013 on Windows 8
I appreciate any help or advice.
Thanks
Barry
I've had a look around the forums but can't find anything.
I found a script on the Internet that auto prints email attachments to your default printer as soon as they arrive. Seemed simple enough and it works. However, now every time I receive an email, regardless if it has an attachment, I get the error : 424 - Object required. The only option I have is to click OK to make the box disappear.
The guide said:
In Outlook, go to Developer tab and click "Visual Basic" button
If you don't have "Developer" tab, go to customize your ribbon/toolbar and add "Developer"
In new window titled "Microsoft Visual Basic for Applications", double-click "ThisOutlookSession" icon in the tree on left side and paste the following script text into the new window on the right:
Sub LSPrint(Item As Outlook.MailItem)
On Error GoTo OError
'detect Temp
Dim oFS As FileSystemObject
Dim sTempFolder As String
Set oFS = New FileSystemObject
'Temporary Folder Path
sTempFolder = oFS.GetSpecialFolder(TemporaryFolder)
'creates a special temp folder
cTmpFld = sTempFolder & "\OETMP" & Format(Now, "yyyymmddhhmmss")
MkDir (cTmpFld)
'save & print
Dim oAtt As Attachment
For Each oAtt In Item.Attachments
FileName = oAtt.FileName
FullFile = cTmpFld & "\" & FileName
'save attachment
oAtt.SaveAsFile (FullFile)
'prints attachment
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.NameSpace(0)
Set objFolderItem = objFolder.ParseName(FullFile)
objFolderItem.InvokeVerbEx ("print")
Next oAtt
'Cleanup
If Not oFS Is Nothing Then Set oFS = Nothing
If Not objFolder Is Nothing Then Set objFolder = Nothing
If Not objFolderItem Is Nothing Then Set objFolderItem = Nothing
If Not objShell Is Nothing Then Set objShell = Nothing
OError:
If Err <> 0 Then
MsgBox Err.Number & " - " & Err.Description
Err.Clear
End If
Exit Sub
End Sub
Go to menu Tools > References and add a reference to "Microsoft Scripting Runtime". Click OK button to close References window.
Hit Save icon on top toolbar and close Visual Basic window.
Create a rule in Outlook for all incoming messages from a certain person (or from who you receive those attachments) and choose run a script action.
I am hoping that someone who knows what they're doing could tell me what needs to be changed.
I'm using it on Outlook 2013 on Windows 8
I appreciate any help or advice.
Thanks
Barry