ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Closing a workbook and printing a non-active page (https://www.excelbanter.com/excel-programming/336446-closing-workbook-printing-non-active-page.html)

Sleeping Bear[_2_]

Closing a workbook and printing a non-active page
 
I have two questions.

I receive a .csv file of data that I open, do some manipulation, and then
copy all of the data into another workbook. I want to close the worksheet
containing the .csv data and do that with

Windows("Printing.csv").Activate
ActiveWindow.WindowState = xlMaximized
ActiveWindow.Close

The problem I have is that a message box about "A large amount of data on
the clipboard" comes up and I have to click on "No" to close it. Is there a
way to pass the "No" with the close command and avoid the message box
entirely?

A little later in the macro, I print a worksheet that has been modified by
several of the preceding steps. The worksheet is not active (actually, I'd
like to hide it) but to print it, I have to make it active, then print it,
then activate a different worksheet. Is there a way to print an inactive
and/or hidden worksheet?

Any suggestions would be appreciated. Thanks.

Ron de Bruin

Closing a workbook and printing a non-active page
 
Hi

Use this after the Copy to clear the clipboard

Application.CutCopyMode = False

You can't print a hidden sheet but you can print a sheet that is not active
See http://www.rondebruin.nl/print.htm#Print

And
http://www.rondebruin.nl/print.htm#visible

--
Regards Ron de Bruin
http://www.rondebruin.nl


"Sleeping Bear" wrote in message ...
I have two questions.

I receive a .csv file of data that I open, do some manipulation, and then
copy all of the data into another workbook. I want to close the worksheet
containing the .csv data and do that with

Windows("Printing.csv").Activate
ActiveWindow.WindowState = xlMaximized
ActiveWindow.Close

The problem I have is that a message box about "A large amount of data on
the clipboard" comes up and I have to click on "No" to close it. Is there a
way to pass the "No" with the close command and avoid the message box
entirely?

A little later in the macro, I print a worksheet that has been modified by
several of the preceding steps. The worksheet is not active (actually, I'd
like to hide it) but to print it, I have to make it active, then print it,
then activate a different worksheet. Is there a way to print an inactive
and/or hidden worksheet?

Any suggestions would be appreciated. Thanks.




Sleeping Bear[_2_]

Closing a workbook and printing a non-active page
 
I put that in after the Copy so it reads:

Cells.Select
Selection.Copy
Application.CutCopyMode = False

and now get "Run Time error 1004 - Paste method of worksheet calss failed."
Is there something else I need?


"Ron de Bruin" wrote:

Hi

Use this after the Copy to clear the clipboard

Application.CutCopyMode = False

You can't print a hidden sheet but you can print a sheet that is not active
See http://www.rondebruin.nl/print.htm#Print

And
http://www.rondebruin.nl/print.htm#visible

--
Regards Ron de Bruin
http://www.rondebruin.nl


"Sleeping Bear" wrote in message ...
I have two questions.

I receive a .csv file of data that I open, do some manipulation, and then
copy all of the data into another workbook. I want to close the worksheet
containing the .csv data and do that with

Windows("Printing.csv").Activate
ActiveWindow.WindowState = xlMaximized
ActiveWindow.Close

The problem I have is that a message box about "A large amount of data on
the clipboard" comes up and I have to click on "No" to close it. Is there a
way to pass the "No" with the close command and avoid the message box
entirely?

A little later in the macro, I print a worksheet that has been modified by
several of the preceding steps. The worksheet is not active (actually, I'd
like to hide it) but to print it, I have to make it active, then print it,
then activate a different worksheet. Is there a way to print an inactive
and/or hidden worksheet?

Any suggestions would be appreciated. Thanks.





Ron de Bruin

Closing a workbook and printing a non-active page
 
Hi

I mean after you Copy/Paste

--
Regards Ron de Bruin
http://www.rondebruin.nl


"Sleeping Bear" wrote in message ...
I put that in after the Copy so it reads:

Cells.Select
Selection.Copy
Application.CutCopyMode = False

and now get "Run Time error 1004 - Paste method of worksheet calss failed."
Is there something else I need?


"Ron de Bruin" wrote:

Hi

Use this after the Copy to clear the clipboard

Application.CutCopyMode = False

You can't print a hidden sheet but you can print a sheet that is not active
See http://www.rondebruin.nl/print.htm#Print

And
http://www.rondebruin.nl/print.htm#visible

--
Regards Ron de Bruin
http://www.rondebruin.nl


"Sleeping Bear" wrote in message
...
I have two questions.

I receive a .csv file of data that I open, do some manipulation, and then
copy all of the data into another workbook. I want to close the worksheet
containing the .csv data and do that with

Windows("Printing.csv").Activate
ActiveWindow.WindowState = xlMaximized
ActiveWindow.Close

The problem I have is that a message box about "A large amount of data on
the clipboard" comes up and I have to click on "No" to close it. Is there a
way to pass the "No" with the close command and avoid the message box
entirely?

A little later in the macro, I print a worksheet that has been modified by
several of the preceding steps. The worksheet is not active (actually, I'd
like to hide it) but to print it, I have to make it active, then print it,
then activate a different worksheet. Is there a way to print an inactive
and/or hidden worksheet?

Any suggestions would be appreciated. Thanks.







Sleeping Bear[_2_]

Closing a workbook and printing a non-active page
 
That got it. Thanks.

"Ron de Bruin" wrote:

Hi

I mean after you Copy/Paste

--
Regards Ron de Bruin
http://www.rondebruin.nl


"Sleeping Bear" wrote in message ...
I put that in after the Copy so it reads:

Cells.Select
Selection.Copy
Application.CutCopyMode = False

and now get "Run Time error 1004 - Paste method of worksheet calss failed."
Is there something else I need?


"Ron de Bruin" wrote:

Hi

Use this after the Copy to clear the clipboard

Application.CutCopyMode = False

You can't print a hidden sheet but you can print a sheet that is not active
See http://www.rondebruin.nl/print.htm#Print

And
http://www.rondebruin.nl/print.htm#visible

--
Regards Ron de Bruin
http://www.rondebruin.nl


"Sleeping Bear" wrote in message
...
I have two questions.

I receive a .csv file of data that I open, do some manipulation, and then
copy all of the data into another workbook. I want to close the worksheet
containing the .csv data and do that with

Windows("Printing.csv").Activate
ActiveWindow.WindowState = xlMaximized
ActiveWindow.Close

The problem I have is that a message box about "A large amount of data on
the clipboard" comes up and I have to click on "No" to close it. Is there a
way to pass the "No" with the close command and avoid the message box
entirely?

A little later in the macro, I print a worksheet that has been modified by
several of the preceding steps. The worksheet is not active (actually, I'd
like to hide it) but to print it, I have to make it active, then print it,
then activate a different worksheet. Is there a way to print an inactive
and/or hidden worksheet?

Any suggestions would be appreciated. Thanks.








All times are GMT +1. The time now is 02:12 PM.

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