VBA-Printer option

  • Thread starter Thread starter Edward
  • Start date Start date
E

Edward

I think unlike WOrd it's not possible in PP to activate printerdialogbox
using VBA, I know how to write print code but the problem is users don't have
the option to make changes in the print settings and this code prints
automatically without showing printdialog box. I know we can make those
changes in printdialogbox and then run this macro ( because this code doesn't
alter the latest settings ) but is there a way to show the installed printers
in a dropdown and give the user the option to select one . maybe with an
Windows API call ? ( the reason I need to sue this macro is because I have a
special sequence of slide with specific sslide numbering to print so this
print code works with some others macros to do this )
 
You are looking for the PrintDialog which should be a control you can drop
onto a form.



Austin Myers
AT&W Technologies

Creators of PowerPoint add-ins
 
Thanks. I checked all the Activex Controls and couldn't find any print
control. Is there any ActiveX print control? We can't activate Printdialogbox
in PP with dialog.show method something like
Application.FileDialog(msoFileDialogOpen).Show
or maybe you are referring to something else?
--
Best regards,
Edward


Austin Myers said:
You are looking for the PrintDialog which should be a control you can drop
onto a form.



Austin Myers
AT&W Technologies

Creators of PowerPoint add-ins
 
Edward,
Austin is refering to the PrintDialog control that is available on a system
if you have Visual Studio installed.

Alternative is to use Windows API to display the printer dialog. If you
google you should find several sites offering code to do the same.


--
Regards,
Shyam Pillai

Animation Carbon: Copy/Paste/Share animation libraries.
www.animationcarbon.com


Edward said:
Thanks. I checked all the Activex Controls and couldn't find any print
control. Is there any ActiveX print control? We can't activate
Printdialogbox
in PP with dialog.show method something like
Application.FileDialog(msoFileDialogOpen).Show
or maybe you are referring to something else?
 
Thanks Steve. This shows the printdialog box but after we make our settings
and click OK it will print watever we have in print range ,but I need to
print like 80% of the slides which have specific tags and renumebr them using
a differnt code so what I need is a way to show the user some of printer
current settings and ability to change them ( in particcular I need to show
differnt printers installed in a machine in a dropdown and ability to change
them).

It's a long code but I'm pasting it here to show what I really need to do.


Sub printSlide(sldNum As Long)

With ActivePresentation.PrintOptions
.RangeType = ppPrintSlideRange

With .Ranges
.ClearAll
.Add Start:=sldNum, End:=sldNum

End With

.NumberOfCopies = 1
.Collate = msoTrue
.OutputType = ppPrintOutputSlides

.FitToPage = msoFalse
.FrameSlides = msoFalse

End With
ActivePresentation.PrintOut
End Sub

Sub PrintWithoutFlypage()

Dim osld As Slide
Dim lx As Long
Dim oShp As Shape
Dim lCount As Long
lCount = 0
On Error GoTo errorhandler


For Each osld In ActivePresentation.Slides
osld.HeadersFooters.SlideNumber.Visible = msoFalse
Next
Call DeletePath <---- call to a method to delet certain elements
'This line prints coverpage
Call printSlide(ActivePresentation.Slides(1).SlideNumber) <--- call to
the first method for printing.
'I used the Ubound slide number of the last slide which is difefrent than
slideindex
'Of the last slide because we statrt at 0
For lx = 2 To ActivePresentation.Slides.Count
If ActivePresentation.Slides(lx).Tags.Count = 0 Then
lCount = lCount + 1
If ActivePresentation.PageSetup.SlideWidth = 780 Then
Set oShp =
ActivePresentation.Slides(lx).Shapes.AddTextbox(msoTextOrientationHorizontal,
756, 523.44, 15.84, 24.48)
Else
'Make sure this setting is working for A4size too
Set oShp =
ActivePresentation.Slides(lx).Shapes.AddTextbox(msoTextOrientationHorizontal,
700.46, 523.44, 12.24, 18)
End If

With oShp.TextFrame
.MarginBottom = 0
.MarginLeft = 0
.MarginRight = 0
.MarginTop = 0
.WordWrap = msoFalse
End With

With oShp.TextFrame.TextRange
.Text = lCount
.Font.Name = "Trade Gothic LT Std"
.Font.Size = 10
.ParagraphFormat.Alignment = ppAlignCenter
.ParagraphFormat.WordWrap = msoFalse

End With


Call printSlide(ActivePresentation.Slides(lx).SlideNumber)
oShp.Delete
ElseIf ActivePresentation.Slides(lx).Tags.Count > 0 Then
If ActivePresentation.Slides(lx).Tags.Name(1) = "PREFACE" Then
lCount = lCount + 1
If ActivePresentation.PageSetup.SlideWidth = 780 Then
Set oShp =
ActivePresentation.Slides(lx).Shapes.AddTextbox(msoTextOrientationHorizontal,
756, 523.44, 15.84, 24.48)
Else

Set oShp =
ActivePresentation.Slides(lx).Shapes.AddTextbox(msoTextOrientationHorizontal,
700.46, 523.44, 12.24, 18)
End If

With oShp.TextFrame
.MarginBottom = 0
.MarginLeft = 0
.MarginRight = 0
.MarginTop = 0
.WordWrap = msoFalse
End With

With oShp.TextFrame.TextRange
.Text = lCount
.Font.Name = "Trade Gothic LT Std"
.Font.Size = 10
.ParagraphFormat.Alignment = ppAlignCenter
.ParagraphFormat.WordWrap = msoFalse

End With


Call printSlide(ActivePresentation.Slides(lx).SlideNumber)
oShp.Delete
End If
End If
Next
For Each osld In ActivePresentation.Slides
osld.HeadersFooters.SlideNumber.Visible = msoTrue
Next
Exit Sub

errorhandler:
MsgBox Err.Description, vbCritical, CompName

End Sub
 
Back
Top