Inserer un pdf dans un commentaire Excel

bonjour,

je recherche une macro qui pourrez mettre un fichier pdf dans un commentaire comme une image

es-que cela et possible ?

j’ai trouver un code qui fonctionne très bien avec une image serai t-il possible de l’adapter au fichier PDF

Option Explicit

Dim picture_selected As Boolean, cell_selected As Boolean

Private Function PickPictureDialogOpen() As String

PickPictureDialogOpen = ""

Dim lngCount As Long

' Open the file dialog

With Application.FileDialog(msoFileDialogFilePicker)

'on autorise a sélectionner qu'une image

.AllowMultiSelect = False

.Filters.Add "Images", "*.gif; *.jpg; *.pdf; *.jpeg", 1

'.Show

If .Show <> 0 Then

picture_selected = True

PickPictureDialogOpen = .SelectedItems(1)

End If

End With

End Function

Private Sub selectOneCell()

Dim x As Boolean

Dim celres As Range

On Error Resume Next

Do While Not x

Set celres = Application.InputBox("Sélectionnez une cellule", Title:="Sélectionnez une cellule", Type:=8)

If celres Is Nothing Then

'MsgBox "Cell not selected!"

Exit Sub

End If

Select Case celres.Count

Case Is = 1

x = True

cell_selected = True

celres.Select

Case Else

MsgBox "Ne sélectionnez qu'une cellule"

End Select

Loop

End Sub

Public Sub CommentaireAvecImage()

Dim chemin_image As String

picture_selected = False

cell_selected = False

chemin_image = PickPictureDialogOpen

selectOneCell

If picture_selected = False Or cell_selected = False Then

End

Else

Dim iPict As IPictureDisp, HauteurImage As Double, LargeurImage As Double

Set iPict = LoadPicture(chemin_image)

HauteurImage = Round((iPict.Height) / 21.16, 0)

LargeurImage = Round((iPict.Width) / 21.16, 0)

With Selection

.ClearComments

.AddComment

.Comment.Text Text:=""

With .Comment

.Shape.Fill.UserPicture chemin_image

.Shape.ScaleWidth 1, msoFalse, msoScaleFromTopLeft

.Shape.ScaleHeight 1, msoFalse, msoScaleFromTopLeft

.Shape.LockAspectRatio = msoFalse

.Shape.Height = HauteurImage

.Shape.Width = LargeurImage

End With

End With

Set iPict = Nothing

End If

End Sub

Par avance merci.

Bonjour,

Quelqu'un pourrait m'aider?

Merci.

Bonjour,

jamais vu de pdf dans un commentaire.

Et les transformer en image serait une mauvaise idée vu le poids que ton fichier prendra.

Met un lien dans une cellule.

eric

Rechercher des sujets similaires à "inserer pdf commentaire"