Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / September 2006

Tip: Looking for answers? Try searching our database.

Embeded Word document in Access

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Leif - 29 Sep 2006 02:16 GMT
Failed to attract a response after 2 weeks under forms coding.  Trying here...

I have Access 2003.

I'm trying to programmatically load a Word document into Access via OLE.  I
have a table with a field called Reqmnts.  Its data type is OLE Object.  I
have a form with a bound Object Frame to the OLE Object.  The field has an
"OLE Type Allowed" of Either.  

If I use drag-and-drop of a Word document to the bound field on the form the
document is embeded with no problem.  However, if I try to add the file
programmatically, I get an error 2793, "Position Profile Design (TEST) can't
perform the operation specified in the Action Property of the Visual Basic
procedure you're trying to run".  This error occurs on the the setting of
Action.

My code is below.  gOLEFileName is a global that is set via my modal form
ImportOLE.

Private Sub CmdAddWordDoc_Click()
   On Error GoTo Err_cmdAddWordDoc_Click

   ' Make sure a level is selected prior to editting
       'Make sure record is selected for editing
   If IsNull(SRqmntID) = True Then
       MsgBox "Specify Record", vbCritical, "Level must be selected for
adding a Word document"
       GoTo cmdAddWordDoc_Click_Exit
   Else
       ' Get the file name to load
       DoCmd.OpenForm "ImportOLE", acNormal, , , , acDialog
       
       If gOLEFileName <> "" Then
           ' Load the requirements
           With [sfrm_Profile_Attributes_EditB]![Reqmnts]
               .Class = "Word.Document"
               .OLETypeAllowed = acOLEEmbedded
               .SourceDoc = gOLEFileName
               .Action = acOLECreateEmbed
               .Size = acOLESizeZoom
           End With
       End If
       gOLEFileName = ""
   End If
   
cmdAddWordDoc_Click_Exit:
   Exit Sub

Err_cmdAddWordDoc_Click:
   MsgBox Error$
   Resume cmdAddWordDoc_Click_Exit

End Sub

Thanks,
Leif
Stephen Lebans - 29 Sep 2006 03:35 GMT
Have you stepped through your code and verified that the gOLEFileName var
contains a valid/existing file name and path?
Do you have Norton Antivirus running? Try Disabling it.

Signature

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.

> Failed to attract a response after 2 weeks under forms coding.  Trying
> here...
[quoted text clipped - 56 lines]
> Thanks,
> Leif
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.