S
Shawn777
Is there any way of getting the number of pages that are to be printed in VBA.
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Shawn777 said:I've been working with that code and it doesn't produce the correct pages to
be printed. It use to work months ago - now I changed the macro and it
doesn’t work right.
Below is my code, as you can see I've been trying different options with no
luck.
Sub PrintAreaDirect()
'Dim strWB As String
'Dim strName As String
'Dim strFiller As String
'Dim lngCount As Long
'strWB = "[" & ActiveWorkbook.Name & "]"
'strName = Worksheets(23).Name
'strFiller = "get.document(50,""" & strWB & strName & """)"
'lngCount = Application.ExecuteExcel4Macro(strFiller)
Sheets("DIRECT").Select
Application.Run "'RCA_RB3 06-122-S2 all crafts_rev 2 WBU
macros.xls'!Enlarge"
Application.Run "'RCA_RB3 06-122-S2 all crafts_rev 2 WBU
macros.xls'!ReduceDir"
ActiveSheet.ResetAllPageBreaks
ActiveSheet.PageSetup.PrintArea = "$B$1:$N$199"
With ActiveSheet.PageSetup
.CenterHorizontally = True
.Orientation = xlLandscape
.FitToPagesWide = 1
End With
Range("H1").Select
MsgBox Application.ExecuteExcel4Macro("GET.DOCUMENT(50)") & " pages will
be printed."
' If ExecuteExcel4Macro("GET.DOCUMENT(50)") <> 1 Then
Rows("59:59").Select
Range("B59").Activate
ActiveWindow.SelectedSheets.HPageBreaks.Add Before:=ActiveCell
Application.Run "PrintPage"
' Else
' Application.Run "PrintPage"
' End If
End Sub
Ron de Bruin said:Hi Shawn777
See how I use it here
http://www.rondebruin.nl/print.htm#not
TotPages = Application.ExecuteExcel4Macro("GET.DOCUMENT(50)")
Ron de Bruin said:Hi Shawn
Oops I posted it first in your other thread
Difficult to see the problem from here.
Do you have the problem also with more workbooks ?
--
Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm
Shawn777 said:I've been working with that code and it doesn't produce the correct pages to
be printed. It use to work months ago - now I changed the macro and it
doesn’t work right.
Below is my code, as you can see I've been trying different options with no
luck.
Sub PrintAreaDirect()
'Dim strWB As String
'Dim strName As String
'Dim strFiller As String
'Dim lngCount As Long
'strWB = "[" & ActiveWorkbook.Name & "]"
'strName = Worksheets(23).Name
'strFiller = "get.document(50,""" & strWB & strName & """)"
'lngCount = Application.ExecuteExcel4Macro(strFiller)
Sheets("DIRECT").Select
Application.Run "'RCA_RB3 06-122-S2 all crafts_rev 2 WBU
macros.xls'!Enlarge"
Application.Run "'RCA_RB3 06-122-S2 all crafts_rev 2 WBU
macros.xls'!ReduceDir"
ActiveSheet.ResetAllPageBreaks
ActiveSheet.PageSetup.PrintArea = "$B$1:$N$199"
With ActiveSheet.PageSetup
.CenterHorizontally = True
.Orientation = xlLandscape
.FitToPagesWide = 1
End With
Range("H1").Select
MsgBox Application.ExecuteExcel4Macro("GET.DOCUMENT(50)") & " pages will
be printed."
' If ExecuteExcel4Macro("GET.DOCUMENT(50)") <> 1 Then
Rows("59:59").Select
Range("B59").Activate
ActiveWindow.SelectedSheets.HPageBreaks.Add Before:=ActiveCell
Application.Run "PrintPage"
' Else
' Application.Run "PrintPage"
' End If
End Sub
Ron de Bruin said:Hi Shawn777
See how I use it here
http://www.rondebruin.nl/print.htm#not
TotPages = Application.ExecuteExcel4Macro("GET.DOCUMENT(50)")
--
Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm
Is there any way of getting the number of pages that are to be printed in VBA.
Ron de Bruin said:Hi Shawn
Oops I posted it first in your other thread
Difficult to see the problem from here.
Do you have the problem also with more workbooks ?
--
Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm
Shawn777 said:I've been working with that code and it doesn't produce the correct pages to
be printed. It use to work months ago - now I changed the macro and it
doesn’t work right.
Below is my code, as you can see I've been trying different options with no
luck.
Sub PrintAreaDirect()
'Dim strWB As String
'Dim strName As String
'Dim strFiller As String
'Dim lngCount As Long
'strWB = "[" & ActiveWorkbook.Name & "]"
'strName = Worksheets(23).Name
'strFiller = "get.document(50,""" & strWB & strName & """)"
'lngCount = Application.ExecuteExcel4Macro(strFiller)
Sheets("DIRECT").Select
Application.Run "'RCA_RB3 06-122-S2 all crafts_rev 2 WBU
macros.xls'!Enlarge"
Application.Run "'RCA_RB3 06-122-S2 all crafts_rev 2 WBU
macros.xls'!ReduceDir"
ActiveSheet.ResetAllPageBreaks
ActiveSheet.PageSetup.PrintArea = "$B$1:$N$199"
With ActiveSheet.PageSetup
.CenterHorizontally = True
.Orientation = xlLandscape
.FitToPagesWide = 1
End With
Range("H1").Select
MsgBox Application.ExecuteExcel4Macro("GET.DOCUMENT(50)") & " pages will
be printed."
' If ExecuteExcel4Macro("GET.DOCUMENT(50)") <> 1 Then
Rows("59:59").Select
Range("B59").Activate
ActiveWindow.SelectedSheets.HPageBreaks.Add Before:=ActiveCell
Application.Run "PrintPage"
' Else
' Application.Run "PrintPage"
' End If
End Sub
Ron de Bruin said:Hi Shawn777
See how I use it here
http://www.rondebruin.nl/print.htm#not
TotPages = Application.ExecuteExcel4Macro("GET.DOCUMENT(50)")
--
Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm
Is there any way of getting the number of pages that are to be printed in VBA.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.