Condividi tramite

DOC WORD - Stampa automatica

Anonimo
2020-01-13T17:45:08+00:00

Buongiorno,

Ho realizzato un modulo VB che apre word e crea un documento con tutti i dati, il documento si genera da un template di word, funziona tutto, quello che volevo e far stampare e chiudere word (non serve salvarlo) è possibile?

Che comandi devo usare?

Grazie

Laura

Microsoft 365 e Office | Access | Per la casa | Windows

Domanda bloccata. Questa domanda è stata eseguita dalla community del supporto tecnico Microsoft. È possibile votare se è utile, ma non è possibile aggiungere commenti o risposte o seguire la domanda.

0 commenti Nessun commento

8 risposte

Ordina per: Più utili
  1. Anonimo
    2020-01-14T20:46:34+00:00

    Ho un problema, con il comando 

    xWord.Application.Quit SaveChanges:=wdDoNotSaveChanges

    il processo non stampa o meglio il pdf è illeggibile (ora stampo su file PDF per le prove) 

    Questo fa bloccare anche access 

    Potete aiutarmi 

    Grazie

    La risposta è stata utile?

    0 commenti Nessun commento
  2. Anonimo
    2020-01-14T15:42:09+00:00

    Intendevi cosi? (considera che non sono una molto esperta)

    Private Sub Document_open()

    Set xWord = Word.Application

    Options.PrintBackground = True

    xWord.ActiveDocument.PrintOut

    ' Chiudi il documento senza salvare

    ' xWord.ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges

    ' Oppure

    ' Chiudi WORD senza salvare il documento

    xWord.Application.Quit SaveChanges:=wdDoNotSaveChanges

    xWord.Quit

    Set xWord = Nothing

    End Sub

    La risposta è stata utile?

    0 commenti Nessun commento
  3. Anonimo
    2020-01-14T10:38:09+00:00

    ciao Laura,

    ricordati anche di distruggere l'istanza creata...solo qualora te ne sia scoradata e passa al late binding una volta finito lo sviluppo.

    Ciao, Sandro.

    La risposta è stata utile?

    0 commenti Nessun commento
  4. Anonimo
    2020-01-14T10:31:50+00:00

    Grazie Sandro,

    sono riuscita, ho anche inserito il comando per chiudere word quello che non sono riuscita è far eseguire all'aperture del foglio di word

    Private Sub Document_open()

    Options.PrintBackground = True

    ActiveDocument.PrintOut

    ' Chiudi il documento senza salvare il documento 

    ' ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges

    ' Oppure

    ' Chiudi WORD senza salvare il documento

    Application.Quit SaveChanges:=wdDoNotSaveChanges

    End Sub

    La risposta è stata utile?

    0 commenti Nessun commento
  5. Anonimo
    2020-01-14T07:42:29+00:00

    ciao Laura,

    vedi se questo ti aiuta :

    https://docs.microsoft.com/en-us/office/vba/api/word.options.printbackground

    Ciao, Sandro.

    La risposta è stata utile?

    0 commenti Nessun commento