Access - Error 438 Outlook, Imprimir adjunto automaticamente (Script)

 
Vista:

Error 438 Outlook, Imprimir adjunto automaticamente (Script)

Publicado por Miguel (1 intervención) el 05/02/2020 18:24:15
Buen día,

Intento imprimir automáticamente los adjuntos que vengan del área comercial al almacén (PDF / DOC) Desde Outlook 2016.
Sin embargo me aparece el codigo de error 438 El objeto no admite esta propiedad o método.

Me pudieran apoyar identificando algun error y posible solución


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
Sub AttachmentPrint(Item As Outlook.MailItem)
 
    On Error GoTo OError
 
    'This script finds systems temp folders,
    'saves any attachments, and runs the Print
    'command for that file.
 
    Dim oFS As FileSystemObject
    Dim sTempFolder As String
    Set oFS = New FileSystemObject
    sTempFolder = oFS.GetSpecialFolder(TemporaryFolder)
 
    cTmpFld = sTempFolder & "\OETMP" & Format(Now, "yyyymmddhhmmss")
    MkDir (cTmpFld)
 
    'In the next few lines, you'll see an entry that
    'says FileType = .This line gets the last 4
    'characters of the file name, which we'll use later.
 
    Dim oAtt As Attachment
        For Each oAtt In Item.Attachments
           FileName = oAtt.FileName
           FileType = LCase$(Right$(FileName, 4))
           FullFile = cTmpFld & "\" & FileName
            oAtt.SaveAsFile (FullFile)
 
            'We're using the FileType text. Note that it's the
            'last 4 characters os the file name, shich is why
            'the next chunk has .xls and xlsx (without the period)
            '- the period counts as the fourth character.
            'Insert any file extention you want printed.
 
            Select Case FileType
            Case ".doc", "docx", ".pdf"
                Set objShell = CreateObject("Shell.Application")
                Set objFolder = objShell.NameSpace(0)
                Set objFolderItem = objFolder.ParseName(FullFile)
                objFolderItem.InvokeVebrEx ("Print")
            End Select
        Next oAtt
 
        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
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder