Pookiemeister
Well-known Member
- Joined
- Jan 6, 2012
- Messages
- 623
- Office Version
- 365
- 2010
- Platform
- Windows
Code:
Option Explicit
Private Sub CommandButton1_Click()
Workbook_BeforeClose
End Sub
Private Sub UserForm_Initialize()
Me.Caption = "Print, Save and Close"
With Me.Label1
.Caption = "Do you want to print, save and close the workbook named: " & """" & ActiveWorkbook.Name & """" & "?"
.Font = "Tahoma"
.Font.Size = "14"
End With
Me.CommandButton1.Caption = "Yes"
Me.CommandButton2.Caption = "No"
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode = 0 Then
Cancel = True
MsgBox "The X is disbled, please use a button on the form", vbCritical, "X is Disabled"
End If
End Sub
At this point in time the code below is still unfinished until I can figure out how to call the workbook_BeforeClose Event
Workbook_BeforeClose Code Below
Code:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim sFilePath As String
Dim sFileName As String
sFilePath = "C:\Users\UserNamer\Desktop\CompanyFolder\Project\Yield_Report\FileStorage\"
sFileName = Range("C11")
End Sub
Thank you