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
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