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!

Problem in Retreiving the content of Wod Document in VBA

Status
Not open for further replies.

nkavitha

Programmer
Jun 8, 2001
5
US
Hai,

I am developing an application of Resume Maintenance, and Resumen(word documents) are stored in the database using OLE object Field. In the form, I am attaching the word document into a OLE object control(Bound Object Frame Control) using Common Dialog Control.

Here is the deal :
I am able Attach, View the contents of the Field. But I couldn't print the Document. But I am able to print the contents of currently attache document using SourceDoc property of the OLE control. But I couldn't print the contents, becuase MS Access is not maintaining the SourceDoc.

This is my code for Attach, View & Print:

Private Sub cmdAttach_Click()
comDlg.ShowOpen
Me.CandidateResume.SourceDoc = comDlg.FileName
Me.CandidateResume.Action = acOLECreateEmbed
End Sub

'Print the document
Private Sub cmdPrint_Click()
Dim obj As word.Application
' This line where I am getting error.
' I couldn't map the ole object with Word object.
Set obj = Me.CandidateResume.Object
'To open the word document
Me.CandidateResume.Action = acOLEActivate
With obj
.Documents.Open me.CandidateResume.SourceDoc
'To avoid interruption of other process while printing
.PrintOut background:=False
.Quit
End With
Set obj = Nothing
End Sub


'View the Document
Private Sub cmdView_Click()
Me.CandidateResume.Action = acOLEActivate
End Sub

Please let me know, can anybody correct this code or having alternate solution.

Thanks in Advance
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top