Luis Diaz
asked on
Excel: Define front for sheet 1 and back for sheet 2
Hello experts,
I have the attached document related to my shortcuts.
I was wondering how to:
1-Set up print zone and define front related to sheet 1 and back related to sheet 2
So the result will be two sheets in a the same doc.
This will allows me to have in a single doc if I generate a pdf or if I print document sheet 1 and sheet 2.
If you have questions, please contact me.
Thank you for your help.
1-Key-shortcuts-LDI.xlsx
I have the attached document related to my shortcuts.
I was wondering how to:
1-Set up print zone and define front related to sheet 1 and back related to sheet 2
So the result will be two sheets in a the same doc.
This will allows me to have in a single doc if I generate a pdf or if I print document sheet 1 and sheet 2.
If you have questions, please contact me.
Thank you for your help.
1-Key-shortcuts-LDI.xlsx
ASKER
Thank you but it doesn't reply to the need. which is to create a single front and back pages pdf based on two sheets.
ASKER
I found a solution which is to to export the various sheets into a single pdf file.
I was wondering if someone can help me to adjust the following:
With the following requirements:
-Instead of selecting the various sheets i.e. : Sheets(Array("1", "2")).Select I need to loop into the various sheets of activeworkbook
-Open exported folder Shell "C:\WINDOWS\explorer.exe """ & FolderPath & "", vbNormalFocus
If you have questions, please contact me.
I was wondering if someone can help me to adjust the following:
Sub Export_Sheets_One_Pdf()
Dim FolderPath As String
FolderPath = ActiveWorkbook.Path
Sheets(Array("1", "2")).Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, FileName:=FolderPath & "\Export" & "_" & Format(Now, "yyyymmddhhmmss"), _
openafterpublish:=False, ignoreprintareas:=False
End Sub
With the following requirements:
-Instead of selecting the various sheets i.e. : Sheets(Array("1", "2")).Select I need to loop into the various sheets of activeworkbook
-Open exported folder Shell "C:\WINDOWS\explorer.exe """ & FolderPath & "", vbNormalFocus
If you have questions, please contact me.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you very much for this proposal. It works.
Possible to have a last version to exclude specific sheet by name (E.g name: Instruction) in loop:
Possible to have a last version to exclude specific sheet by name (E.g name: Instruction) in loop:
ActiveWorkbook.Worksheets(1).Select
For i = 2 To ActiveWorkbook.Worksheets.Count
ActiveWorkbook.Worksheets(i).Select False
Next
Thank you for your help.
Added another variable (bFirst), so here is the complete routine:
Sub Export_Sheets_One_Pdf()
Dim FolderPath As String
Dim i As Integer
Dim pid As Long
Dim bFirst As Boolean
FolderPath = ActiveWorkbook.Path
bFirst = True
For i = 1 To ActiveWorkbook.Worksheets.Count
If ActiveWorkbook.Worksheets(i).Name <> "Instruction" Then
If bFirst Then
bFirst = False
ActiveWorkbook.Worksheets(i).Select
Else
ActiveWorkbook.Worksheets(i).Select False
End If
End If
Next
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=FolderPath & "\Export" & "_" & Format(Now, "yyyymmddhhmmss"), _
openafterpublish:=False, ignoreprintareas:=False
cmd = "C:\WINDOWS\explorer.exe """ & FolderPath & """"
pid = Shell(cmd, vbNormalFocus)
End Sub
ASKER
Thank you.
Just for my knowledge. Why not putting bfirst=false at the end first if condition. Line 14 and not at the beginning?
Just for my knowledge. Why not putting bfirst=false at the end first if condition. Line 14 and not at the beginning?
Are you asking why I don't switch around lines 13 and 14?
It makes no difference ... it would have the same effect.
It makes no difference ... it would have the same effect.
ASKER
Noted. Unable to test it right now. I will keep you informed.
ASKER
Tested and it works.
Thank you for your help.
Thank you for your help.
You are most welcome.
Here is one solution.
https://www.experts-exchange.com/questions/29149323/How-to-Use-Custom-Defined-Range-in-Excel-Camera-Tool.html