Dear Team,
Greetings of the day!
We want to print visible sheets in given workbook except one sheet which is contains embedded file. But we want to print that embedded file only.
Ex. in given workbook, there are 3 sheets. Sheet3 is hidden. If user want to include that sheet to print, they can choose. Otherwise we want to print Sheet1 and embedded file only (word document) in Sheet2. We don't want to print sheet2's page. if user want to include Sheet3, then we want to print Sheet1, embedded file in Sheet2 and Sheet3. We have given command button to print. Is it possible in vba? Kindly help me.
Print only embedded file in specific sheet
-
- 5StarLounger
- Posts: 737
- Joined: 24 Aug 2017, 07:43
Print only embedded file in specific sheet
You do not have the required permissions to view the files attached to this post.
-
- Administrator
- Posts: 78237
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Print only embedded file in specific sheet
See the attached version.
You do not have the required permissions to view the files attached to this post.
Best wishes,
Hans
Hans
-
- 5StarLounger
- Posts: 737
- Joined: 24 Aug 2017, 07:43
Re: Print only embedded file in specific sheet
Dear Sir,
Its been a while. I hope you are doing well.
Thank you so much for your kind reply sir. It is working fine. I have one doubt sir. If user want to print all the sheets as single pdf what to do sir? I tried with the ExportAsFixedFormat Type:=xlTypePDF. But it didn't work for me. Kindly tell me sir. It would be very helpful.
Once again thank you so much sir.
Its been a while. I hope you are doing well.
Thank you so much for your kind reply sir. It is working fine. I have one doubt sir. If user want to print all the sheets as single pdf what to do sir? I tried with the ExportAsFixedFormat Type:=xlTypePDF. But it didn't work for me. Kindly tell me sir. It would be very helpful.
Once again thank you so much sir.
-
- Administrator
- Posts: 78237
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Print only embedded file in specific sheet
Hi Boobalan, I'm fine; I hope you are too.
If you want to save all sheets to a single PDF file, use
(Replace Test.pdf with the path and filename you want to use).
If you want to save specific sheets, copy those sheets to a new workbook, save that to PDF, then close the new workbook without saving it:
If you want to save all sheets to a single PDF file, use
Code: Select all
ActiveWorkbook.ExportAsFixedFormat Type:=xlTypePDF, FileName:="Test.pdf"
If you want to save specific sheets, copy those sheets to a new workbook, save that to PDF, then close the new workbook without saving it:
Code: Select all
Application.ScreenUpdating = False
Worksheets(Array("Sheet1", "Sheet3")).Copy
ActiveWorkbook.ExportAsFixedFormat Type:=xlTypePDF, Filename:="Test.pdf"
ActiveWorkbook.Close SaveChanges:=False
Application.ScreenUpdating = True
Best wishes,
Hans
Hans
-
- 5StarLounger
- Posts: 737
- Joined: 24 Aug 2017, 07:43
Re: Print only embedded file in specific sheet
I am fine. Thank you so much sir. My doubt is we have embedded file na sir. That is our issue. Sheet1 and Sheet3 is not an issue. Sheet2 is an issue sir. Due to embedded file.
Why because, we are not saving Sheet2 as pdf. Instead we are trying to save embedded file as pdf. While saving as a single pdf in the given order is a problem sir.
Sheet 1, embedded file, Sheet 3. In this order we need to save as pdf sir. Is it possible to save as single pdf file sir?
Why because, we are not saving Sheet2 as pdf. Instead we are trying to save embedded file as pdf. While saving as a single pdf in the given order is a problem sir.
Sheet 1, embedded file, Sheet 3. In this order we need to save as pdf sir. Is it possible to save as single pdf file sir?
-
- Administrator
- Posts: 78237
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Print only embedded file in specific sheet
Oh, I didn't get that.
There is no direct way to do that with VBA. You'd have to use a third-party utility that can merge multiple PDF files into one. I cannot help you with that.
There is no direct way to do that with VBA. You'd have to use a third-party utility that can merge multiple PDF files into one. I cannot help you with that.
Best wishes,
Hans
Hans
-
- 5StarLounger
- Posts: 737
- Joined: 24 Aug 2017, 07:43
Re: Print only embedded file in specific sheet
I understood sir. But, thank you so much sir