Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default BeforePrint event

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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default BeforePrint event

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
"EnglishTeacher" wrote in 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.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default BeforePrint event

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
"EnglishTeacher" wrote in 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.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default BeforePrint event

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
"EnglishTeacher" wrote in message
...
| 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
| "EnglishTeacher" wrote in
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.
|
|
|


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default BeforePrint event

Thanks. I'll give that a try.

"Jim Rech" wrote:

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
"EnglishTeacher" wrote in message
...
| 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
| "EnglishTeacher" wrote in
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.
|
|
|



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Print preview error from BeforePrint macro LauriS Excel Discussion (Misc queries) 1 December 6th 07 12:06 AM
BeforePrint macro Steve O Excel Discussion (Misc queries) 4 September 21st 05 01:09 AM
Help with BeforePrint Eric[_7_] Excel Programming 2 October 9th 03 07:44 PM
OnTime event not firing in Workbook_Open event procedure GingerTommy Excel Programming 0 September 24th 03 03:18 PM


All times are GMT +1. The time now is 09:28 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"