Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Printing Two Docs in Word from VB
Message
Information générale
Forum:
Visual Basic
Catégorie:
Autre
Divers
Thread ID:
00207480
Message ID:
00207794
Vues:
17
>>The following error occurs when printing the second document when I am running the compiled (EXE) version of the program.
>>"Windows cannot print due to a problem with the current printer setup
>>try one or more of the following " plus some bullshit suggestions ...including "reinstall the printer driver. 5142"
>>It prints the first document fine.
>>
>>Here is the code:
>>dim appwd as word.application
>>dim appdoc as word.document, appdoc2 as word.document
>>set appwd = new word application
>>set appdoc = appwd.documents(file1)
>>appwd.activedocument.printout()
>>appwd.activedocument.close
>>
>>'call 5 second delay to let word do its thing
>>
>>set appdoc2 = appwd.documents(file2)
>>appwd.activedocument.printout()
>>appwd.activedocument.close
>>
>>'call another delay to let word close out its print buffer
>>
>>set appdoc = nothing
>>set appdoc2 = nothing
>>appwd.quit
>>set appwd = nothing
>>
>>It works fine when run from within VB.
>
>I remember having this problem sometime ago. If I remember well, setting the Background property to False helped me a lot.
>
>Try this: appwd.activedocument.printout Background:=False

What you may also want to do is in your 5 second delay, have it in a loop which calls the sub DoEvents

That has also helped me and others I know in the past.

Hugo
"My get up and go must've got up and went"
-Steve Tyler, Aerosmith
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform