+ Reply to Thread
Results 1 to 8 of 8

User Form automatically sends SMS Text Msg when user presses Submit Button

Hybrid View

  1. #1
    Registered User
    Join Date
    12-19-2020
    Location
    Alberta, Canada
    MS-Off Ver
    365
    Posts
    28

    User Form automatically sends SMS Text Msg when user presses Submit Button

    Hi Team,

    I'm back, seeking guidance from this Amazing Community. This is the most ambitious component to my project and I need HELP in a big way.

    We have a program at work where a Team Member reports Safe and Unsafe working conditions. Currently this process is paper driven and the Management Team gets the information late in the day instead of right away.

    The scope of the project is to have a User Form send a SMS text message when the Team Member presses the Submit Button but only if the condition being reported is "Unsafe". I do not want to rely on the TM in any way and the process of sending the SMS needs to be automatic and without their input and knowledge.

    I don't want the collected data to be dumped in any random order but strung together to make an intelligent text communication. Please see the attached, condensed, version to gain insight into this project.

    Once again Thank You to all the People out there contributing to the success of others!

    Cheers
    Attached Files Attached Files
    Last edited by BigHungarian; 03-10-2021 at 12:45 PM. Reason: Solved

  2. #2
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,027

    Re: User Form automatically sends SMS Text Msg when user presses Submit Button

    You can send an SMS message by sending an email if you know the person's cell phone service provider and SMS gateway domain of the service provider. For example, if you look at the line in red in the code below, I have used a dummy 10 digit phone number and the SMS gateway domain for Bell Canada. Have a look at this link for the SMS gateway domains of most service providers: https://en.wikipedia.org/wiki/SMS_gateway
    Change the phone number and gateway domain to suit your needs. You can test the macro by inserting the information for your own cell number.
    Private Sub CommandButton1_Click()
        Application.ScreenUpdating = False
        Dim LastRow As Long, ws As Worksheet
        Dim OutApp As Object, OutMail As Object
        Set ws = Sheets("Data")
        LastRow = ws.Range("A" & Rows.Count).End(xlUp).Row + 1 'Finds the last blank row
        ws.Range("A" & LastRow).Value = ComboBox1.Text 'Adds the TextBox3 into Col A & Last Blank Row
        ws.Range("B" & LastRow).Value = ComboBox2.Text
        ws.Range("C" & LastRow).Value = ComboBox3.Text
        ws.Range("D" & LastRow).Value = TextBox1.Text
        ws.Range("E" & LastRow).Value = TextBox2.Text
        If ComboBox3.Text = "Unsafe" Then
            Set OutApp = CreateObject("Outlook.Application")
            Set OutMail = OutApp.CreateItem(0)
            With OutMail
                .To = "1234567890@txt.bell.ca"
                .Subject = "Unsafe condition reported"
                .HTMLBody = ComboBox1.Text & " is reporting an unsafe condition." & vbNewLine & _
                    "Location: " & ComboBox2.Text & vbNewLine & _
                    "Details :" & TextBox1.Text & vbNewLine & _
                    "Outcome: " & TextBox2.Text & vbNewLine
                .send
            End With
        End If
        Application.ScreenUpdating = True
    End Sub
    Last edited by Mumps1; 02-20-2021 at 03:20 PM.
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

  3. #3
    Registered User
    Join Date
    12-19-2020
    Location
    Alberta, Canada
    MS-Off Ver
    365
    Posts
    28

    Re: User Form automatically sends SMS Text Msg when user presses Submit Button

    Hi Mumps1. Thanks for your help with my project. When sending the SMS it needs to be send it to 4 recipients at once.

    Your additional help would be appreciated.

    Thanks

  4. #4
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,027

    Re: User Form automatically sends SMS Text Msg when user presses Submit Button

    Simply put them all between the quotes separated by a semi-colon:
    .To = "1234567890@txt.bell.ca;1234567890@txt.bell.ca;1234567890@txt.bell.ca;1234567890@txt.bell.ca"

  5. #5
    Registered User
    Join Date
    12-19-2020
    Location
    Alberta, Canada
    MS-Off Ver
    365
    Posts
    28

    Re: User Form automatically sends SMS Text Msg when user presses Submit Button

    Hello Mumps1,

    I need to circle back to this bit of code you've helped me out with.

    If ComboBox3.Text = "Unsafe" Then. I need to add another category that would trigger the sending of the Text Msg. but I cant figure out how to stitch them together.

    Example:

    If ComboBox3.Text = "Unsafe" ; "Very Unsafe" Then

    Ya, it's not as easy as that... I've tried many variations but have turned up unsuccessful. Help Please.

    Thanks

  6. #6
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,027

    Re: User Form automatically sends SMS Text Msg when user presses Submit Button

    Try:
    If ComboBox3.Text = "Unsafe" Or ComboBox3.Text = "Very Unsafe" Then

  7. #7
    Registered User
    Join Date
    12-19-2020
    Location
    Alberta, Canada
    MS-Off Ver
    365
    Posts
    28

    Re: User Form automatically sends SMS Text Msg when user presses Submit Button

    SOLVED*** AGAIN *** Most Excellent... WORKS Perfectly!

    Thanks Mumps1

  8. #8
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,027

    Re: User Form automatically sends SMS Text Msg when user presses Submit Button

    My pleasure.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Command button in user form that will read text in Spanish.
    By Matt_in_CA in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-24-2024, 07:25 AM
  2. Automatically get sum value of cells selected by user for User Form's Label ?
    By karmapala in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-14-2019, 04:09 AM
  3. Populate text boxes on user form, from combo box on same user form
    By Richardswaim in forum Excel Programming / VBA / Macros
    Replies: 26
    Last Post: 07-03-2016, 09:35 AM
  4. Replies: 2
    Last Post: 06-03-2015, 05:21 PM
  5. [SOLVED] whenever i submit button it opens an workstation files where user details there i dont wan
    By baig123 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-30-2014, 01:29 AM
  6. [SOLVED] How do I keep the Excel UserForm from clearing when user Presses Done
    By eemiller1997 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-26-2012, 10:35 AM
  7. [SOLVED] Clearing a Combo Box then trying to submit user form to Workbook gives error messages
    By colvinb in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-21-2012, 02:18 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1