crashbrown98
Member
- Outlook version
- Outlook 2010 32 bit
- Email Account
- Exchange Server
Hello,
I have a script to print attachments automatically and itworks well however when it prints it does it as actual size instead offit. Is there a way to adjust the scriptto do it as fit instead of actual size for .pdf
Here is the code used:
Sub LSPrint(Item As Outlook.MailItem)
On Error GoToOError
'detect Temp
Dim oFS AsFileSystemObject
Dim sTempFolder AsString
Set oFS = NewFileSystemObject
'Temporary FolderPath
sTempFolder =oFS.GetSpecialFolder(TemporaryFolder)
'creates a specialtemp folder
cTmpFld =sTempFolder & "\OETMP" & Format(Now,"yyyymmddhhmmss")
MkDir (cTmpFld)
'save & print
Dim oAtt AsAttachment
For Each oAtt In Item.Attachments
FileName =oAtt.FileName
FullFile =cTmpFld & "\" & FileName
'save attachment
oAtt.SaveAsFile(FullFile)
'printsattachment
Set objShell =CreateObject("Shell.Application")
Set objFolder =objShell.NameSpace(0)
SetobjFolderItem = objFolder.ParseName(FullFile)
objFolderItem.InvokeVerbEx ("print")
Next oAtt
'Cleanup
If Not oFS IsNothing Then Set oFS = Nothing
If Not objFolderIs Nothing Then Set objFolder = Nothing
If NotobjFolderItem Is Nothing Then Set objFolderItem = Nothing
If Not objShell IsNothing Then Set objShell = Nothing
OError:
If Err <> 0Then
MsgBoxErr.Number & " - " & Err.Description
Err.Clear
End If
Exit Sub
End Sub
I have a script to print attachments automatically and itworks well however when it prints it does it as actual size instead offit. Is there a way to adjust the scriptto do it as fit instead of actual size for .pdf
Here is the code used:
Sub LSPrint(Item As Outlook.MailItem)
On Error GoToOError
'detect Temp
Dim oFS AsFileSystemObject
Dim sTempFolder AsString
Set oFS = NewFileSystemObject
'Temporary FolderPath
sTempFolder =oFS.GetSpecialFolder(TemporaryFolder)
'creates a specialtemp folder
cTmpFld =sTempFolder & "\OETMP" & Format(Now,"yyyymmddhhmmss")
MkDir (cTmpFld)
'save & print
Dim oAtt AsAttachment
For Each oAtt In Item.Attachments
FileName =oAtt.FileName
FullFile =cTmpFld & "\" & FileName
'save attachment
oAtt.SaveAsFile(FullFile)
'printsattachment
Set objShell =CreateObject("Shell.Application")
Set objFolder =objShell.NameSpace(0)
SetobjFolderItem = objFolder.ParseName(FullFile)
objFolderItem.InvokeVerbEx ("print")
Next oAtt
'Cleanup
If Not oFS IsNothing Then Set oFS = Nothing
If Not objFolderIs Nothing Then Set objFolder = Nothing
If NotobjFolderItem Is Nothing Then Set objFolderItem = Nothing
If Not objShell IsNothing Then Set objShell = Nothing
OError:
If Err <> 0Then
MsgBoxErr.Number & " - " & Err.Description
Err.Clear
End If
Exit Sub
End Sub