
Originally Posted by
simcode
I'll have a try if you can supply sufficent data in your book.
What data do you need more?
Const sRANGE_1 As String = "J1:AB75" '-> checkbox1
Const sRANGE_2 As String = "J76:AB150" '-> checkbox2
Const sRANGE_3 As String = "J151:AB225" '-> checkbox3
Const sRANGE_4 As String = "J226:AB300" '-> checkbox4
Const sRANGE_5 As String = "J301:AB375" '-> checkbox5
Const sRANGE_6 As String = "J376:AB450" '-> checkbox6
Const sRANGE_7 As String = "J451:AB525" '-> checkbox7
Const sRANGE_8 As String = "J1:AB525" '-> checkbox8
Const sRANGE_9 As String = "J1:AB525" '-> checkbox9
Const sRANGE_10 As String = "J1:AB525" '-> checkbox10
Const sRANGE_11 As String = "J1:AB525" '-> checkbox11
Consider those ranges according to checkbox's numbers.
For the message do be displayed:
sMessage = "As seguintes secções foram impressas:"
'vaCheckBoxes = frm.SelectedCheckBoxes
For iCheckBoxNo = LBound(vaCheckBoxes, 1) To UBound(vaCheckBoxes, 1)
If vaCheckBoxes(iCheckBoxNo, 1) = True Then
If rSelectedRanges Is Nothing Then
Set rSelectedRanges = vaPrintRanges(iCheckBoxNo)
Else: Set rSelectedRanges = Union(rSelectedRanges, _
vaPrintRanges(iCheckBoxNo))
End If
If vaCheckBoxes(iCheckBoxNo, 2) <> vbNullString Then
sMessage = sMessage & vbLf & vbLf & vbTab & vaCheckBoxes(iCheckBoxNo, 2)
End If
End If
Next iCheckBoxNo
If Not rSelectedRanges Is Nothing Then
Set wks = vaPrintRanges(1).Parent
sFileName = wks.Range(Celula_Nr_Entrada_OP).Value & ".pdf"
On Error Resume Next
Kill PATH_OP & sFileName
On Error GoTo 0
rSelectedRanges.ExportAsFixedFormat Type:=xlTypePDF, _
Filename:=PATH_OP & sFileName, _
OpenAfterPublish:=True
MsgBox sMessage
End If
You have all this information in the module imprimirPDF
If anything more you need, let me know, i really need this with urgency please
Bookmarks