Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi all,
We have a multiple page/worksheet excel file that uses a macro to print all of the worksheets to a single pdf file. this works fine btw :) the problem now is that i want to extend the excel file to include some OLE word/pdf documents that can be printed using the same button. these OLD objects will be multiple pages in length. macro so far: ################################################## Sub Print_PDF() Application.ActivePrinter = "CutePDF Writer on CPW2:" Sheets("DATA ENTRY & PRESENTATION SHEET").Select Sheets("BRIEFING").Select False Sheets("METHOD").Select False Sheets("SHEET1").Select False Sheets("RISK MATRIX").Select False Sheets("BLANK RISK").Select False Sheets("RISKS DATABASE").Select False ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True End Sub ################################################## now, i found this code: ################################################## Dim wksWithWordDocs As Worksheet Dim wordObject As OLEObject Dim wordDocument As Word.Document Set wksWithWordDocs = ThisWorkbook.Worksheets("Sheet1") For Each wordObject In wksWithWordDocs.OLEObjects wordObject.Activate Set wordDocument = wordObject.Object wordDocument.PrintOut wordDocument.Close Next wordObject ################################################## it apparently will print out old objects but it doesnt work for me, even if i set up a Reference to Microsoft Word 11.0 Object library in the VB editor. i get a 'run-time error 1004 - unable to find object propert of the OLEObject class' with this line: Set wordDocument = wordObject.Object any ideas? thanks in advance peeps :) |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
as another approach, allowing then system to open up and print the (prevously
ole embedded) documents would also work, if this is an easier option. "Liam T" wrote: Hi all, We have a multiple page/worksheet excel file that uses a macro to print all of the worksheets to a single pdf file. this works fine btw :) the problem now is that i want to extend the excel file to include some OLE word/pdf documents that can be printed using the same button. these OLD objects will be multiple pages in length. macro so far: ################################################## Sub Print_PDF() Application.ActivePrinter = "CutePDF Writer on CPW2:" Sheets("DATA ENTRY & PRESENTATION SHEET").Select Sheets("BRIEFING").Select False Sheets("METHOD").Select False Sheets("SHEET1").Select False Sheets("RISK MATRIX").Select False Sheets("BLANK RISK").Select False Sheets("RISKS DATABASE").Select False ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True End Sub ################################################## now, i found this code: ################################################## Dim wksWithWordDocs As Worksheet Dim wordObject As OLEObject Dim wordDocument As Word.Document Set wksWithWordDocs = ThisWorkbook.Worksheets("Sheet1") For Each wordObject In wksWithWordDocs.OLEObjects wordObject.Activate Set wordDocument = wordObject.Object wordDocument.PrintOut wordDocument.Close Next wordObject ################################################## it apparently will print out old objects but it doesnt work for me, even if i set up a Reference to Microsoft Word 11.0 Object library in the VB editor. i get a 'run-time error 1004 - unable to find object propert of the OLEObject class' with this line: Set wordDocument = wordObject.Object any ideas? thanks in advance peeps :) |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
how do I print multiple print areas on one page | Excel Discussion (Misc queries) | |||
Embedded objects(?) | Excel Discussion (Misc queries) | |||
Embedded Objects | Excel Discussion (Misc queries) | |||
How do I print a one page spreadsheet multiple time, each with its own page number? | Excel Discussion (Misc queries) | |||
embedded objects | Excel Programming |