Pasting an Image and Repositioning it with VBA
I have a problem that I've been stuck on all day and I would appreciate any help.
I have a vba macro that I've written in excel that opens a pdf in Acrobat and pastes the contents of a cell into the PDF as an image.
My problem is at that point I want to be able to move the image to a different position within the PDF page. I can select the annotation using like so:
PDFPage = doc.AquirePage(PDFview.GetPageNum)
Set annot = PDFPage.GetAnnot(0)
However, there doesn't appear to be any settings that can be used with this variable to determine position.
I cannot use the function jso.getAnnot to set a variable because I do not know the name of the annotation. I have attempted to use the function jso.getAnnots() like so:
Private AcroApp As Acrobat.CAcroApp
Private doc As Acrobat.CAcroPDDoc
Dim jso As Object
Dim Annotations() As Variant
Set AcroApp = CreateObject("AcroExch.App")
Set doc = CreateObject("AcroExch.PDDoc")
Set AVDoc = CreateObject("AcroExch.AVDoc")
If AVDoc.Open(sPath, "") = True Then
Set doc = AVDoc.GetPDDoc
End If
AcroApp.Show
ThisWorkbook.Sheets("table").Range("R1").Copy
AcroApp.MenuItemExecute("Paste")
Set jso = doc.GetJSObject
Annotations = jso.getAnnots()
debug.print UBound(Annotations)
However, my debug print is returning a length of zero for Annotations, so I've clearly done something wrong there.
I would be grateful for any help.
