U
Uwe
Hi developers,
I have to print worddocs coming as mail attachments with the office viewer.
Is this possible via vba?
If there is word installed, my script runs well:
=====================================
' this prints with the associated application
Dim hwnd As Long
Dim ret As Long
ret = ShellExecute(hwnd, "Print", fname, "", "", 0)
=====================================
but with office viewer installed, it is not possible to use this command:
ret = 31: SE_ERR_NOASSOC
I think because the office viewer doesn't offer the possibility to print
directly (no print entry in the context menue in explorer)
With word I can also do it this way:
=====================================
Set app = createobject("Word.application")
Set docToPrint = app.documents.open(fname)
' Turn off background printing to avoid error message cf. Microsoft Technote
#Q170393
PrintBackground = app.Options.PrintBackground()
If PrintBackground = True Then app.Options.PrintBackground = False
Call docToPrint.PrintOut()
app.Options.PrintBackground = PrintBackground 'Restore PrintBackground
option
=====================================
is there a possibility to call the office viewer in the same way?
Thanks in advance for any help
Uwe
I have to print worddocs coming as mail attachments with the office viewer.
Is this possible via vba?
If there is word installed, my script runs well:
=====================================
' this prints with the associated application
Dim hwnd As Long
Dim ret As Long
ret = ShellExecute(hwnd, "Print", fname, "", "", 0)
=====================================
but with office viewer installed, it is not possible to use this command:
ret = 31: SE_ERR_NOASSOC
I think because the office viewer doesn't offer the possibility to print
directly (no print entry in the context menue in explorer)
With word I can also do it this way:
=====================================
Set app = createobject("Word.application")
Set docToPrint = app.documents.open(fname)
' Turn off background printing to avoid error message cf. Microsoft Technote
#Q170393
PrintBackground = app.Options.PrintBackground()
If PrintBackground = True Then app.Options.PrintBackground = False
Call docToPrint.PrintOut()
app.Options.PrintBackground = PrintBackground 'Restore PrintBackground
option
=====================================
is there a possibility to call the office viewer in the same way?
Thanks in advance for any help
Uwe