Forum Discussion
UserForm Mac OS - VBA Programming
Hello! Thank you for your efforts in writing this code. I started working by studying your code. But I can’t figure out how to make it so that in the userform, when the .Caption = “Click Me” button is pressed, the current sheet is automatically saved in a separate book and this sheet is printed.
On Windows I created the code:
Private Sub cmdSave_Click()
If TextBox1.Text = "" Then
MsgBox("Cannot Empty!")
Else
Range("e5").Value = TextBox1.Text
End If
If TextBox2.Text = "" Then
MsgBox("Cannot Empty!")
Else
Range("c6").Value = TextBox2.Text
End If
If TextBox3.Text = "" Then
MsgBox("Cannot Empty!")
Else
Range("e6").Value = TextBox3.Text
End If
If TextBox4.Text = "" Then
MsgBox("Cannot Empty!")
Else
Range("c9").Value = TextBox4.Text
End If
If TextBox5.Text = "" Then
MsgBox("Cannot Empty!")
Else
Range("d9").Value = TextBox5.Text
End If
If TextBox6.Text = "" Then
MsgBox("Cannot Empty!")
Else
Range("a18").Value = TextBox6.Text
End If
Unload Me
End Sub
Sub Workbook_BeforePrint(Cancel As Boolean)
If Saved = False Then
End If
End Sub
Option Explicit
Sub Make_PDF()
Dim pdfName As String
pdfName = Range("A9").Text & Format$(Date, " mm-dd-yyyy") & ".pdf"
ActiveSheet.ExportAsFixedFormat_
Type:=xlTypePDF, _
FileName:=pdfName, _
Quality:=xlQualityMinimum, _
IncludeDocProperties:=False, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=True
End Sub
Please tell me what needs to be changed in your code example to get the same result in Excel for Mac?
- Aleksey_A_PolyakovOct 17, 2023Copper ContributorI use: Sonoma and Excel version 16.78