Closing a workbook and printing a non-active page

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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

Ask a Question

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.

Ask a Question

Back
Top