I have a list with form numbers in a database. When I press the Print button (which i created in the application) on a selected form number it transfers the data from Access into a Word template and saves it as another name (according the the form number). However if i try to 'print' a second form number, runtime error 462 kicks in.
When i press the Print button this is what happens:
- gets the form number selected from the list box
-call a procedure to print
The procedure to print declares the following objects:
then opens the Word template:
fills in the word template and finally:
If this procedure is run the second time it produces the error. Thanks for the help :)
When i press the Print button this is what happens:
- gets the form number selected from the list box
-call a procedure to print
The procedure to print declares the following objects:
Code:
Dim oApp As Word.Application
Dim oDoc As Word.Document
Dim oTable As Word.Table
Code:
Set oApp = New Word.Application
Set oDoc = oApp.Documents.Open(myPath + "\condemnation certificate template.doc")
Code:
Set oTable = Nothing
oDoc.SaveAs myPath + "\" + strCertNo + ".doc"
oApp.Quit
Set oDoc = Nothing
Set oApp = Nothing