![]() |
|
#1
|
|||
|
|||
|
I know that this is not a preferred method, but I have inherited a database that requires this functionality for now. I need to save my Word documents in a function to Ole Bound Objects and can't find the vba code anywhere. I have a function that prints out the reports, but would like to modify to save as ole bounds. Three stars for anyone who can help, I'm googled out!
Code:
Public Function OpenWordDoc() As Boolean
OpenWordDoc = True
Dim objApp As Object
Dim objWord As Object
Dim strSQL As String
Dim NewCLS_Batch As DAO.Database
Dim rstLatentReports As DAO.Recordset
Dim IntI As Integer
Set NewCLS_Batch = CurrentDb
Set rstLatentReports = NewCLS_Batch.OpenRecordset("qryselectlatentreports")
rstLatentReports.MoveFirst
Set objWord = CreateObject("Word.Application")
objWord.Visible = False
If rstLatentReports.EOF Then Exit Function
IntI = 1
With rstLatentReports
Do Until .EOF
Set objDoc = objWord.Documents.Add()
Dim MyNewPathName As String
MyNewPathName = rstLatentReports.Fields("mypathname")
objWord.PrintOut , , , , , , , , , , , , MyNewPathName
On Error Resume Next
.MoveNext
IntI = IntI + 1
Loop
End With
rstLatentReports.Close
NewCLS_Batch.Close
End Function
Last edited by macropod; 12-17-2013 at 03:46 PM. Reason: Added code tags & formatting |
|
#2
|
||||
|
||||
|
Hi KSReynolds,
Since this appears to be Access-related, you might get better results by posting your query in the Access forum - http://www.accessforums.net/
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Can no longer read and save WORD documents as TXT files
|
bobk544 | Word | 2 | 11-24-2013 07:22 AM |
Convert equation objects to inline objects
|
sumjoh | Word VBA | 1 | 01-29-2013 08:38 PM |
| Save group of objects as picture - crops off image | Laiza_83 | PowerPoint | 3 | 01-19-2013 06:05 PM |
| Casnnot save files to .pdf (word excel) | JacquesW | Office | 10 | 01-19-2012 11:45 AM |
| Can't save Large Word files to html | Gardener | Word | 0 | 12-25-2011 09:37 AM |