stuck loading embedded files

M

mccarthy

I'm using Access 2003 and need to be able to load many word documents into a
table that will be embedded into a report. I've tried the following code but
it doesn't seem to work with 03. Any suggestions would be extremely welcome.

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
' Get the search path.
MyPath = MyFolder & "\" & "*." & [SearchExtension]
' Get the first file in the path containing the file extension.
MyFile = Dir(MyPath, vbNormal)
Do While Len(MyFile) <> 0
[OLEPath] = MyFolder & "\" & MyFile
[OLEFile].Class = [OLEClass]
[OLEFile].OLETypeAllowed = acOLEEmbedded
[OLEFile].SourceDoc = [OLEPath]
[OLEFile].Action = acOLECreateEmbed <this is where it gets
stuck
' Check for next OLE file in the folder.
MyFile = Dir
' Go to new record on form.
' For Access 95 only, use the following Line of code:
DoCmd.DoMenuItem acFormBar, acEditMenu, 12, 4, acMenuVer70

' For Access 97 only, use the following line of code:
'DoCmd.RunCommand acCmdRecordsGoToNew
Loop

End Sub
 

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