Importing PDF File as OLE Object in Loop

cnc4496

New member
Local time
Today, 08:15
Joined
Jan 17, 2010
Messages
2
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
 
Here is a Link to a demo to do just what you want. Give it a try and see if it does what you want.

David
 
DCrake,

Were you able to use the utility you linked to for importing pdf files? I tried downloading and running your application and only ended up with an error message that popped with the debugger. Tried changing some files to TIFF and JPG and had the same thing happen.

Thanks for the help!
 
Did you read through the documentation it came with? I have made a change to the front end and have attached here. You did not say what you got and at what point you got it. Cannot do much without the relevant info.

David
 

Attachments

Users who are viewing this thread

Back
Top Bottom