Ciao a tutti.
Posto il mio messaggio qui e credo sia LA SOLUZIONE per tutti quelli che hanno il problema in oggetto.
Chiarisco:
Quando si stampa un documento WOrd che ha i margini impostati fuori dai margini fisici della stampante in uso (per fare una prova metterli tutti a 0) viene generato un messaggio che cita:
"I margini della sezione 1 sono esterni all'area di stampa, Continuare?"
Le opzioni sono:
Correggi: imposta automaticamente i margini minimi per la stampante in uso.
Ignora: Stampa cosi' com'e'. Esce quello che esce.
Nessun problema se davanti alla tastiera ci siete voi che in "modalita Omer" premete il bel tastino.
Ma se succede da un programma VB / VBA che succede? resta tutto fermo finche' non premete il tasto dell'opzione scelta.
A nulla vale impostare WordApplication.WDAlertLevel= WdAlertsNone. Il messaggio compare sempre.
Ecco la soluzione.
Impostare la stampa in Background a OFF.
Cito da una slide di un MVP (http://word.mvps.org/FAQs/MacrosVBA/OutsidePrintableArea.htm)
Suppressing message “The margins of section 1 are set outside the printable area of the page. Do you want to
continue ?” when printing from VBA
Article contributed by Ibby
You can use the Application.DisplayAlerts property to avoid this message. However, there is a trap. If background printing is turned on, DisplayAlerts will be turned off, then on before the page is sent to the printer. This results in the message still being displayed. If you tun off background printing, execution of the code will stop until the page is sent to the printer. Then you can turn DisplayAlerts back on.
With Application
' Turn off DisplayAlerts
.DisplayAlerts = wdAlertsNone
' Send document to printer but wait until it
' is sent before turning DisplayAlerts back on
.PrintOut Background:=False
.DisplayAlerts = wdAlertsAll
End With
provato e funziona....
HTH (e credo servira' a molti, o almeno spero...)
Max.