Hello, I have a WB with multiple WS's and on these sheets are a variety of userforms. Some sheets actually have more than one userform on their sheets, depending on what the sheet is for. Everything works fine, all of the userforms play together well so that is fine. The users have noted that they would like to send me a quick email right from the userforms without breaking out of the WB. So I whipped another userform with a couple of text boxes in it to allow the users to add in comments and their names and such, this works fine as well. The only thing that they do not like is that it moves them out of the WS that they are in when they access the comment userform. So then they have to navigate back to it.
What has got me stumped is that if I want to add a "comment" button to all of the userforms, how would I tweak the following codes so that after the email is sent you are returned to whatever worksheet you were already on; instead of the suggestion log? Basically they want to stay on the same sheet that they are working on when they call and then close out the suggestion userform. Can anyone point me in a direction to take on trying to do this? I appreciate any input.
This is my Comments code:
This is an example of the code that I am using to call the comment userform, I have this same code populating userforms on 9 sheets:
What has got me stumped is that if I want to add a "comment" button to all of the userforms, how would I tweak the following codes so that after the email is sent you are returned to whatever worksheet you were already on; instead of the suggestion log? Basically they want to stay on the same sheet that they are working on when they call and then close out the suggestion userform. Can anyone point me in a direction to take on trying to do this? I appreciate any input.
This is my Comments code:
VBA Code:
Sub SendButton_Click()
With Sheets("Suggestions")
nextrow = .Range("A" & Rows.Count).End(xlUp).Row + 1
.Range("A" & nextrow) = Now()
.Range("B" & nextrow) = CommentBox.Value
.Range("C" & nextrow) = NameBox.Value
Worksheets("Suggestions").Activate
ActiveSheet.Range("F1:H2").Select
ActiveWorkbook.EnvelopeVisible = True
With ActiveSheet.MailEnvelope
.Introduction = " The following comment or suggestion for the Inspection App is being submitted. "
.Item.To = "username@email.com;"
.Item.Subject = "Inspection App Comment or Suggestion"
.Item.Send
End With
End With
CommentBox.Value = ""
NameBox.Value = ""
Unload SuggestionEmail
End Sub
This is an example of the code that I am using to call the comment userform, I have this same code populating userforms on 9 sheets:
VBA Code:
Private Sub SendComment_Click()
SuggestionEmail.Show
End Sub