打开工作簿时会出现一个消息框。它以询问是否需要帮助的问题结束。
如果答案是“否”,我想退出Sub并允许正常使用。
如果答案是“是”,我希望它运行另一个宏给我发电子邮件。
电子邮件和消息框可以工作,只是不是对答案的React部分。
Private Sub Workbook_Open()
Worksheets("Report").Columns("S:S").EntireColumn.Hidden = True
Worksheets("Report").Columns("T:T").EntireColumn.Hidden = True
Call Campbell_Initiative
End Sub
Sub SendHelp()
Dim xOutApp As Object
Dim xOutMail As Object
Dim xMailBody As String
On Error Resume Next
Set xOutApp = CreateObject("Outlook.Application")
Set xOutMail = xOutApp.CreateItem(0)
xMailBody = "MY NAME," & vbNewLine & vbNewLine & _
"I am having an issues with my report. Can you contact me when you have time?" & vbNewLine & vbNewLine & _
"Respectfully,"
On Error Resume Next
With xOutMail
.To = "MY EMAIL ADDRESS"
.CC = ""
.BCC = ""
.Subject = "FSR WD REPORT HELP"
.Body = xMailBody
.Send
End With
On Error GoTo 0
Set xOutMail = Nothing
Set xOutApp = Nothing
End Sub
Sub Campbell_Initiative()
' Campbell_Initiative Macro
Keyboard Shortcut: Ctrl+e
Range("A2").Select
On Error Resume Next
ActiveSheet.ShowAllData
On Error Resume Next
ActiveSheet.Circlelnvalid
Call OpMsgB
End Sub
Sub OpMsgB()
MsgBox "If you are seeing item circled in RED, those cells do not match the standardized format or list choices." & vbNewLine & vbNewLine & "This is a new report, that was thrown built in a hurry. If you find anyting wrong or need something changed/add, Please contact MY NAME @ MY EMAIL " & vbNewLine & vbNewLine & " Do you need Help?", vbYesNo + vbQuestion, "REPORT HELP"
'If answer = vbNo Then Exit Sub
Call SendHelp
End If
End Sub
1条答案
按热度按时间rdlzhqv91#
只处理
Yes
部分,忽略其余部分。这就是你想要的吗?