Importing pdf file as embedded OLE object into Access

C

cnc4496

I have been trying to do this for several days now and have exhausted the
options that I have previously found posted. I have a need to be able to loop
through a file directory and import each .pdf into an Access table as an
embedded OLE object. I cannot link these in, they must be embedded. The
number of pdf files is relatively minimal (50-60) but this will be used
multiple times for several different Access databases. What I have tried this
far is to import them via a form load, but it keeps getting hung up on
[OLEFile].Action = acOLECreateEmbed saying that it is an invalid action. Here
is my code, any assistance would be much appreciated:


Private Sub cmdLoadOLE_Click()
Dim MyFolder As String
Dim MyExt As String
Dim MyPath As String
Dim MyFile As String
Dim strCriteria As String
MyFolder = Me!SearchFolder
MyPath = MyFolder & "\" & "*." & [SearchExtension]
MyFile = Dir(MyPath, vbNormal)
Do While Len(MyFile) <> 0
[OLEPath] = MyFolder & "\" & MyFile
[OLEFile].Class = "Adobe Acrobat Document"
[OLEFile].OLETypeAllowed = acOLEEmbedded
[OLEFile].SourceDoc = [OLEPath]
[OLEFile].Action = acOLECreateEmbed

DoCmd.RunCommand acCmdRecordsGoToNew
MyFile = Dir
Loop
End Sub
 
G

Graham Mayor

You might do better to ask in a forum for Access vba - this one is for Word?

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top