ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   ExecuteExcel4Macro("GET.DOCUMENT(50)") (https://www.excelbanter.com/excel-programming/403065-executeexcel4macro-get-document-50-a.html)

Shawn777

ExecuteExcel4Macro("GET.DOCUMENT(50)")
 
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?

ilia

ExecuteExcel4Macro("GET.DOCUMENT(50)")
 
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?



Shawn777

ExecuteExcel4Macro("GET.DOCUMENT(50)")
 
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?




Jim Cone

ExecuteExcel4Macro("GET.DOCUMENT(50)")
 

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?

Shawn777

ExecuteExcel4Macro("GET.DOCUMENT(50)")
 
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?


Jim Cone

ExecuteExcel4Macro("GET.DOCUMENT(50)")
 

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-

Shawn777

ExecuteExcel4Macro("GET.DOCUMENT(50)")
 
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-


Jim Cone

ExecuteExcel4Macro("GET.DOCUMENT(50)")
 

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)



Shawn777

ExecuteExcel4Macro("GET.DOCUMENT(50)")
 
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)




Ron de Bruin

ExecuteExcel4Macro("GET.DOCUMENT(50)")
 
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)




Steve Swan

ExecuteExcel4Macro
 
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.



All times are GMT +1. The time now is 10:58 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com