Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open Word, create and save document in Access table 1

Status
Not open for further replies.

SJSFoxPro

Technical User
Jun 19, 2003
110
US
I have an application that needs to do the following:
Shell out to Microsoft Word and make it the active document.
When the user is finished creating the new Word document, the document needs to be saved in a field in an Access table (not as a file on the server or hard drive). (There are specific privacy rules driving the save in the database versus on the server - they've been warned of bloat, etc.)

Can anyone point me in the direction of VBA that can accomplish this? Or, offer suggestions?

Appreciate any help you can provide.
 
Hallo,

2 Options would be to do it all in RTF which can be stored in a memo field, or use an OLE field.
I'd go for RTF as I don't know about OLEs.

- Frink
 
Have you thought of encryption?

After saving the Word document have the document zipped and encrypted. Yea, this does save it to the server, but only people with the right password will have access. And you will not get “bloat” in the database.

I think Winzip has command line options. Or use one of the other free zip products.

Warm regards from Florida. B-)
 
kmsalt, think you're real funny huh? ;-)

The user has been warned heavily of the bloat ramifications of storing the embedded ole objects, but they're adamant they want it...

I have a form now with a datasheet subform bound to the table with the ole object column. The subform has a bound object frame with a control source bound to the ole object column.

So far, it's working great. I have a double click event procedure for the bound object frame control. If the user double clicks a record containing a Microsoft Word document, it opens in Word. If the user double clicks on a new record it performs this:
DoCmd.RunCommand acCmdInsertObject

The insert object dialog box is displayed for the user to select the object type they wish to create and then clicks OK.

The user would still like it to enter directly into a new Microsoft Word document (without the display of the insert object dialog box). (They don't want the option to select another object type.)

So... I have almost exactly what the user desires for the application. Any thoughts on how I could send the parameters to the insert object dialog box in code so the user doesn't have to see it and Microsoft Word would open to a new document window? (I have thought about researching SendKeys, although I hate to use it.)

Very, close...

PS - thanks for the warm regards from Florida... We're being heaped with snow in NH today ;-) I can use the warmth!
 
If I understand correctly you would like to open word to a new blank document. Try this:

Code:
     Set WordApp = CreateObject("Word.Application")
     WordApp.Visible = True
     WordApp.Documents.Add
     Set WordApp = Nothing
 
A little fast on the trigger in my last post. Also add
Code:
Dim WordApp As Word.Application

And you will need to add a reference to Microsoft Word x.0 Object Library
 
jadams0173,

In your suggestion:
Dim WordApp As Word.Application
should be:
Dim WordApp As Object
................................
Actually, I had already offered the user your suggestion. A wizard created button to Run MS Word as an application to create a new doucment. The user didn't like it because upon completion of the document, the document must be saved [somewhere].

What I now have is [almost] EXACTLY what the user wants. Double-click on an existing EMBEDDED Word Document and it opens it in Word. When closed, the user returns to the form where they left off. Double-click on a new record, the insert object dialog box opens allowing the choice of object type. The user selects Microsoft Word and clicks ok. When the document is complete, they click close and return to the Access form where they left off with the new Word Document embedded in the ole object column of the record.

The user would like to NOT see the insert object dialog box. (i.e., programatically send the information for object type as Microsoft Word document and select the ok to go into the new document).

That is what I am looking for an answer to...

At this point, what I have is ok. The user would just prefer to think a little less ;-)

Thanks!
 
Ah, I didn't quite understand what was left. Sorry about that.
 
I know this is way too late for changing technologies, but have you considered Sharepoint? The "WSS" limited Sharepoint features are free for any Windows 2003 Server. One of the major features of Sharepoint is its integration with Office - you can edit files posted to the site and "post back" the changes to the site, all using built-in functionality. Just for future reference--it's out there.
 
Would creating a table with a single blank document and then:
Code:
Private Sub WordDoc_DblClick(Cancel As Integer)
If IsNull(Me.WordDoc) Then
    DoCmd.OpenForm "BlankRec", , , , , acHidden
    Me.WordDoc = Forms!BlankRec.WordDoc
End If
End Sub

suit? A bit long winded ...
 
My solution is so close now to what the user is looking for...

I am hopeful that an answer exists to send the 2+ arguments to the DoCmd.RunCommand acCmdInsertObject to select the object type as Microsoft Word Document and click OK (so the insert dialog box gets its answers and moves right to opening the new Word document).

Thanks to all who have taken the time to contribute. It's great to have different solutions to choose from.
 
Try this. I put a bound object frame control on a form and put this in the double click event.
Code:
Private Sub OLEBound0_DblClick(Cancel As Integer)
 SendKeys "microsoft word {ENTER}", False                     
DoCmd.RunCommand acCmdInsertObject
End Sub
 
jadams0173,

THANK YOU!!! That is exactly what my user wanted. I really appreciate your help!

You get a star from me!

Susan :-D
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top