Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
ExecuteExcel4Macro("GET.DOCUMENT(50)")
Is suppose to provide the number of pages to be printed. I have the following code that reprecents two pages to print it the above code says it is just one. Sub PrintDirect() 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 ExecuteExcel4Macro("GET.DOCUMENT(50)") & " pages will be printed." If ExecuteExcel4Macro("GET.DOCUMENT(50)") = 1 Then Application.Run "PrintPage" Else Rows("59:59").Select Range("B59").Activate ActiveWindow.SelectedSheets.HPageBreaks.Add Befo=ActiveCell Application.Run "PrintPage" End If End Sub This worked for me before and now it doesn't. Anyone know why? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
It doesn't seem to work correctly with Zoom property set to false.
That's as much as I can figure out. I have a one-page document with your fit settings, and the expression returns two. If I set Zoom to 100, it returns 4 which is correct. That seems to make the difference. On Dec 20, 11:21 am, Shawn777 wrote: ExecuteExcel4Macro("GET.DOCUMENT(50)") Is suppose to provide the number of pages to be printed. I have the following code that reprecents two pages to print it the above code says it is just one. Sub PrintDirect() 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 ExecuteExcel4Macro("GET.DOCUMENT(50)") & " pages will be printed." If ExecuteExcel4Macro("GET.DOCUMENT(50)") = 1 Then Application.Run "PrintPage" Else Rows("59:59").Select Range("B59").Activate ActiveWindow.SelectedSheets.HPageBreaks.Add Befo=ActiveCell Application.Run "PrintPage" End If End Sub This worked for me before and now it doesn't. Anyone know why? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Changing the Zoom didn't change anything for me.
Is there another way of counting the number of pages that are to be printed? "ilia" wrote: It doesn't seem to work correctly with Zoom property set to false. That's as much as I can figure out. I have a one-page document with your fit settings, and the expression returns two. If I set Zoom to 100, it returns 4 which is correct. That seems to make the difference. On Dec 20, 11:21 am, Shawn777 wrote: ExecuteExcel4Macro("GET.DOCUMENT(50)") Is suppose to provide the number of pages to be printed. I have the following code that reprecents two pages to print it the above code says it is just one. Sub PrintDirect() 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 ExecuteExcel4Macro("GET.DOCUMENT(50)") & " pages will be printed." If ExecuteExcel4Macro("GET.DOCUMENT(50)") = 1 Then Application.Run "PrintPage" Else Rows("59:59").Select Range("B59").Activate ActiveWindow.SelectedSheets.HPageBreaks.Add Befo=ActiveCell Application.Run "PrintPage" End If End Sub This worked for me before and now it doesn't. Anyone know why? |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() That xl4 function has a second argument which takes the sheet name... ExecuteExcel4Macro("GET.DOCUMENT(50, sheetname)") Try running it that way with a "normal" sheet active. Include the workbook name along with the sheet name. -- Jim Cone San Francisco, USA http://www.realezsites.com/bus/primitivesoftware (Excel Add-ins / Excel Programming) "Shawn777" wrote in message ExecuteExcel4Macro("GET.DOCUMENT(50)") Is suppose to provide the number of pages to be printed. I have the following code that reprecents two pages to print it the above code says it is just one. -snip- This worked for me before and now it doesn't. Anyone know why? |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I tried typing in the tab name and the spreadsheet name, neither would work
The spreadsheet name is: rb3 wbu macro.xls The tab name is: DIRECT The path is: C:\Documents and Settings\fogas2\Desktop\Shawn\Clients\OCC\Ring Bus 3 Val\IPA\rb3 wbu macro.xls Could you type it in correctly so I can make sure I did it right? "Jim Cone" wrote: That xl4 function has a second argument which takes the sheet name... ExecuteExcel4Macro("GET.DOCUMENT(50, sheetname)") Try running it that way with a "normal" sheet active. Include the workbook name along with the sheet name. -- Jim Cone San Francisco, USA http://www.realezsites.com/bus/primitivesoftware (Excel Add-ins / Excel Programming) "Shawn777" wrote in message ExecuteExcel4Macro("GET.DOCUMENT(50)") Is suppose to provide the number of pages to be printed. I have the following code that reprecents two pages to print it the above code says it is just one. -snip- This worked for me before and now it doesn't. Anyone know why? |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Here is the syntax I use... (that still doesn't mean the count will be correct) <g '--- Sub LotsOfStrings() 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 = ExecuteExcel4Macro(strFiller) MsgBox lngCount End Sub -- Jim Cone San Francisco, USA http://www.realezsites.com/bus/primitivesoftware (Excel Add-ins / Excel Programming) "Shawn777" wrote in message I tried typing in the tab name and the spreadsheet name, neither would work The spreadsheet name is: rb3 wbu macro.xls The tab name is: DIRECT The path is: C:\Documents and Settings\fogas2\Desktop\Shawn\Clients\OCC\Ring Bus 3 Val\IPA\rb3 wbu macro.xls Could you type it in correctly so I can make sure I did it right? -snip- |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
No, it didn't work. It just returns 4 pages each time.
"Jim Cone" wrote: Here is the syntax I use... (that still doesn't mean the count will be correct) <g '--- Sub LotsOfStrings() 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 = ExecuteExcel4Macro(strFiller) MsgBox lngCount End Sub -- Jim Cone San Francisco, USA http://www.realezsites.com/bus/primitivesoftware (Excel Add-ins / Excel Programming) "Shawn777" wrote in message I tried typing in the tab name and the spreadsheet name, neither would work The spreadsheet name is: rb3 wbu macro.xls The tab name is: DIRECT The path is: C:\Documents and Settings\fogas2\Desktop\Shawn\Clients\OCC\Ring Bus 3 Val\IPA\rb3 wbu macro.xls Could you type it in correctly so I can make sure I did it right? -snip- |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() If you actually print the sheet, how many pages are printed? Jim Cone "Shawn777" wrote in message No, it didn't work. It just returns 4 pages each time. "Jim Cone" wrote: Here is the syntax I use... (that still doesn't mean the count will be correct) <g '--- Sub LotsOfStrings() 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 = ExecuteExcel4Macro(strFiller) MsgBox lngCount End Sub -- Jim Cone San Francisco, USA http://www.realezsites.com/bus/primitivesoftware (Excel Add-ins / Excel Programming) |
#9
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
2 pages are printed - the number it is suppose to be, not the number the
marco says it is. Your's says its 4 pages mine says its 1 page. My code is below, I deactivated everything that doesn't work right. 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 Befo=ActiveCell Application.Run "PrintPage" ' Else ' Application.Run "PrintPage" ' End If End Sub "Jim Cone" wrote: If you actually print the sheet, how many pages are printed? Jim Cone "Shawn777" wrote in message No, it didn't work. It just returns 4 pages each time. "Jim Cone" wrote: Here is the syntax I use... (that still doesn't mean the count will be correct) <g '--- Sub LotsOfStrings() 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 = ExecuteExcel4Macro(strFiller) MsgBox lngCount End Sub -- Jim Cone San Francisco, USA http://www.realezsites.com/bus/primitivesoftware (Excel Add-ins / Excel Programming) |
#10
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Shawn
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" wrote in message ... 2 pages are printed - the number it is suppose to be, not the number the marco says it is. Your's says its 4 pages mine says its 1 page. My code is below, I deactivated everything that doesn't work right. 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 Befo=ActiveCell Application.Run "PrintPage" ' Else ' Application.Run "PrintPage" ' End If End Sub "Jim Cone" wrote: If you actually print the sheet, how many pages are printed? Jim Cone "Shawn777" wrote in message No, it didn't work. It just returns 4 pages each time. "Jim Cone" wrote: Here is the syntax I use... (that still doesn't mean the count will be correct) <g '--- Sub LotsOfStrings() 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 = ExecuteExcel4Macro(strFiller) MsgBox lngCount End Sub -- Jim Cone San Francisco, USA http://www.realezsites.com/bus/primitivesoftware (Excel Add-ins / Excel Programming) |
#11
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Make sure in your Page Setup for your worksheet, and make sure that in the scaling options, the option to 'Adjust To: x% normal size' is selected and not the 'Fit To: x pages wide' option.
|
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
"Document not saved" "error in loading DLL" | Excel Discussion (Misc queries) | |||
How do I move a document from "recent items" to "documents" | New Users to Excel | |||
ExecuteExcel4Macro "SET.PRINT.AREA" Syntax | Excel Programming | |||
Retrieving info from "child" to a "parent" document | Excel Discussion (Misc queries) | |||
Solution "Your changes could not be saved" "The document may be read-only or encrypted" | Excel Discussion (Misc queries) |