BeforePrint event

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

Guest

How can I program a macro so that, when I print a workbook, it will
automatically open and then print other documents to which I have linked?

Thank you in advance.
 
I'd suggest that you write a print macro that goes something like this:

Sub MasterPrint
Activesheet.Printout
Workbooks("SubsidiaryBook1.xls").Open
Activesheet.Printout
ActiveWorkbook.Close False
Workbooks("SubsidiaryBook2.xls").Open
Activesheet.Printout
ActiveWorkbook.Close False
'etc.
End Sub

--
Jim Rech
Excel MVP
| How can I program a macro so that, when I print a workbook, it will
| automatically open and then print other documents to which I have linked?
|
| Thank you in advance.
 
Thank you for this but, going further, in the macro, how can I designate
("SubsidiaryBook1.xls") to be a document that is linked to. Specifically, I
want to put a checkbox in the initial Excel file that, if checked, will
activate a link to a specific document to Open and then Print.

Thank you.
 
If your question is - how do I know the names of the linked workbooks, if
any - then have a look at this:

Sub a()
Dim Links As Variant
Dim Counter As Integer
Links = ActiveWorkbook.LinkSources(xlExcelLinks)
If Not IsEmpty(Links) Then
For Counter = 1 To UBound(Links)
MsgBox Links(Counter)
''Open/Print/Close
Next
End If
End Sub

--
Jim Rech
Excel MVP
| Thank you for this but, going further, in the macro, how can I designate
| ("SubsidiaryBook1.xls") to be a document that is linked to. Specifically,
I
| want to put a checkbox in the initial Excel file that, if checked, will
| activate a link to a specific document to Open and then Print.
|
| Thank you.
|
| "Jim Rech" wrote:
|
| > I'd suggest that you write a print macro that goes something like this:
| >
| > Sub MasterPrint
| > Activesheet.Printout
| > Workbooks("SubsidiaryBook1.xls").Open
| > Activesheet.Printout
| > ActiveWorkbook.Close False
| > Workbooks("SubsidiaryBook2.xls").Open
| > Activesheet.Printout
| > ActiveWorkbook.Close False
| > 'etc.
| > End Sub
| >
| > --
| > Jim Rech
| > Excel MVP
message
| > | > | How can I program a macro so that, when I print a workbook, it will
| > | automatically open and then print other documents to which I have
linked?
| > |
| > | Thank you in advance.
| >
| >
| >
 

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