Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21273

Runtime error 462

$
0
0
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:

Code:

Dim oApp As Word.Application
Dim oDoc As Word.Document
Dim oTable As Word.Table

then opens the Word template:

Code:

Set oApp = New Word.Application
Set oDoc = oApp.Documents.Open(myPath + "\condemnation certificate template.doc")

fills in the word template and finally:

Code:

Set oTable = Nothing
oDoc.SaveAs myPath + "\" + strCertNo + ".doc"

oApp.Quit

Set oDoc = Nothing
Set oApp = Nothing

If this procedure is run the second time it produces the error. Thanks for the help :)

Viewing all articles
Browse latest Browse all 21273

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>