Import PDF Images into Word

This isn’t part of my old website but it’s a handy Macro I wrote today. I wrote this to enable me to import a 100 page PDF into word as an appendix. First I used Adobe Acrobat Professional to save the PDF as *.jpg images (one for each page). Then I ran this script, which creates a new word file with one of the *.jpg images on each page. Once I did that I just copied the contents of the new file into MS Word.

I hope it’s straightforward how it works and that some of you find it helpful.

 

Sub ImportImages()
‘ ImportImages Macro
Set objWord = CreateObject(“Word.Application”)
objWord.Visible = True
Set objDoc = objWord.Documents.Add()
Set objSelection = objWord.Selection
Dim Counter As Integer
Dim CounterForm As String
Dim MainFilename As String
Dim RealFileName As String
MainFilename = “C:\Funct Acceptance\Microsoft Word – U-6446-0002 LCC SMS Functional Proposal_01_Page_”
‘Set Counter
Counter = 1
CounterForm = Format(Counter, “000″)
‘Start of loop
For Counter = 1 To 101
    CounterForm = Format(Counter, “000″)
    RealFileName = MainFilename & CounterForm & “.jpg”
    objSelection.TypeParagraph
    ‘Start of Picture #######################################################
    Set objShape = objSelection.InlineShapes.AddPicture(RealFileName)
    objSelection.TypeParagraph
    objSelection.TypeText “”
    objSelection.TypeParagraph
    objSelection.InsertBreak Type:=wdPageBreak
    ‘End of Picture #######################################################
Next
End Sub


  • Add Comment Register
    You may use these HTML tags: <a> <abbr> <acronym> <b> <blockquote> <cite> <code> <del> <em> <i> <q> <strike> <strong>

  • Comment Feed for this Post
Go to Top