Je peux ouvrir le document pdf à partir de pièces jointes à partir du courrier. Maintenant, je veux copier son contenu. veuillez fournir du code pour sélectionner tout et copier. Voici le code et j'ai mentionné où j'ai besoin d'aide. Je suis en mesure d'ouvrir le document pdf à partir des pièces jointes du courrier. Maintenant, je veux copier son contenu. veuillez fournir du code pour sélectionner tout et copier. Voici le code et j'ai mentionné où j'ai besoin d'aide.impossible de copier des données à partir d'un fichier PDF
Sub ExtractFirstUnreadEmailDetails()
Dim oOlAp As Object, oOlns As Object, oOlInb As Object
Dim oOlItm As Object
Dim objAtt As Outlook.Attachment
'On Error Resume Next
'~~> Outlook Variables for email
Dim eSender As String, dtRecvd As String, dtSent As String
Dim sSubj As String, sMsg As String
Dim AttchType As String
'~~> Get Outlook instance
Set oOlAp = GetObject(, "Outlook.application")
Set oOlns = oOlAp.GetNamespace("MAPI")
Set oOlInb = oOlns.GetDefaultFolder(olFolderInbox)
'~~> Check if there are any actual unread emails 'apurv
'If oOlInb.Items.Restrict("[UnRead] = True").Count = 0 Then 'apurv
' MsgBox "NO Unread Email In Inbox" 'apurv
' Exit Sub 'apurv
' End If 'apurv
'~~> Store the relevant info in the variables
'For Each oOlItm In oOlInb.Items.Restrict("[UnRead] = True")
For Each oOlItm In oOlInb.Items
eSender = oOlItm.SenderEmailAddress
dtRecvd = oOlItm.ReceivedTime
dtSent = oOlItm.CreationTime
sSubj = oOlItm.Subject
sMsg = oOlItm.Body
ToAddress = oOlItm.To
i = ThisWorkbook.ActiveSheet.Cells(Rows.Count, 2).End(xlUp).Row
Range("c" & (i + 1)).Value = eSender
Range("B" & (i + 1)).Value = dtRecvd
'range("c"&(i+1)).Value=dtSent
Range("E" & (i + 1)).Value = sSubj
Range("F" & (i + 1)).Value = sMsg
Range("D" & (i + 1)).Value = ToAddress
If oOlItm.Attachments.Count <> 0 Then
temp = ""
For Each oOlAtch In oOlItm.Attachments
temp = temp & "//" & oOlAtch.Filename
Next
Range("G" & (i + 1)).Value = temp
End If
If oOlItm.Attachments.Count <> 0 Then
temp = ""
For Each oOlAtch In oOlItm.Attachments
If InStr(1, UCase(oOlAtch.Filename), "PDF", vbTextCompare) > 1 Then
oOlAtch.SaveAsFile "D:\Users\apawar\Desktop\Attachments\" & oOlAtch.Filename
Shell "Explorer.exe /e,D:\Users\apawar\Desktop\Attachments\" & oOlAtch.Filename, vbNormalFocus
'NEED HELP HERE......Need to copy all data from pdf doc from 1st page
End If
Next
Range("G" & (i + 1)).Value = temp
End If
Next
MsgBox ("Down loaded successufully")
End Sub
s'il vous plaît voir https://stackoverflow.com/a/37287583/7889129 – Maddy