L
Louis
Hello,
I try to print documents from VBA and ... that sounds easy, but turns out to
be quite complex.
Below a small subroutine intended for that purpose. However it does not
work.
The subroutine:
- starts visio
- load the document
- goes to the apropriate page
- and does not !!! alow me to print
The message is something like "property (print I suppose) not supported".
I tried a few options. See the code
Someone can help !!?
Louis
Note: I am using WindowsXP-professional, Access2003 (containing the examnple
code) and Visio2000 SP2
------------------------
Sub PrintVisioDoc(TheDoc As String, ThePage As Integer, ThePrinter As
String)
Dim visioApp As New Visio.Application
Dim comAddIn As Office.comAddIn
Dim AppPrinter As String
Dim docsObj As Visio.Documents
Dim docObj As Visio.Document
Dim pagsObj As Visio.Pages
Dim pagObj As Visio.Page
'Create instance of Visio
Set visioApp = New Visio.Application
visioApp.Visible = True
'AppPrinter = xlsApp.ActivePrinter
'xlsApp.ActivePrinter = ThePrinter
visioApp.Documents.Open (TheDoc) 'en een paar patches later ... dit
werkt
Set docObj = visioApp.ActiveDocument
Set pagsObj = docObj.Pages
Set pagObj = pagsObj.Item(ThePage) 'pagObj now contains page() name
pagObj.Print 'property not supported ???
'visioApp.ActiveDocument.Pages(ThePage).Print 'property not supported
???
'visioApp.ActiveDocument.PrintOut 'property not supported ???
'pagsObj.Item(1).Print 'property not supported ???
'xlsApp.ActivePrinter = AppPrinter
visioApp.Quit
Set visioApp = Nothing
End Sub
I try to print documents from VBA and ... that sounds easy, but turns out to
be quite complex.
Below a small subroutine intended for that purpose. However it does not
work.
The subroutine:
- starts visio
- load the document
- goes to the apropriate page
- and does not !!! alow me to print
The message is something like "property (print I suppose) not supported".
I tried a few options. See the code
Someone can help !!?
Louis
Note: I am using WindowsXP-professional, Access2003 (containing the examnple
code) and Visio2000 SP2
------------------------
Sub PrintVisioDoc(TheDoc As String, ThePage As Integer, ThePrinter As
String)
Dim visioApp As New Visio.Application
Dim comAddIn As Office.comAddIn
Dim AppPrinter As String
Dim docsObj As Visio.Documents
Dim docObj As Visio.Document
Dim pagsObj As Visio.Pages
Dim pagObj As Visio.Page
'Create instance of Visio
Set visioApp = New Visio.Application
visioApp.Visible = True
'AppPrinter = xlsApp.ActivePrinter
'xlsApp.ActivePrinter = ThePrinter
visioApp.Documents.Open (TheDoc) 'en een paar patches later ... dit
werkt
Set docObj = visioApp.ActiveDocument
Set pagsObj = docObj.Pages
Set pagObj = pagsObj.Item(ThePage) 'pagObj now contains page() name
pagObj.Print 'property not supported ???
'visioApp.ActiveDocument.Pages(ThePage).Print 'property not supported
???
'visioApp.ActiveDocument.PrintOut 'property not supported ???
'pagsObj.Item(1).Print 'property not supported ???
'xlsApp.ActivePrinter = AppPrinter
visioApp.Quit
Set visioApp = Nothing
End Sub