I have the following code that works great on my machine. When I select a row in my spreadsheet and press the "Email Task" control, the macro will launch my personal MS Outlook app.
1) I would like it to create the email based on cursor position, instead of being dependent on the user highlighting the row.
2) It needs to create the email utilizing the user's default email client.
a) When I launch it from my desktop, it uses my personal Outlook app instead of my open, Outlook 365 web app.
b) When co-workers use the macro, it works for some and not others. It may be because the email client isn't open or that the code is not looking for Outlook 365 specifically. I really don't know. I just need it to work, regardless, which to me means it needs to look for conditions of the environment and determine what actions need to take place in order to create the email. I have no idea how to do this part.
Please don't judge my code. I know it is very rudimentary and can probably be done more efficiently, but this is what I have so far.
Thank you for help on this!! I have been struggling for weeks. Getting this right means our team can effectively communicate.
Office 365 (some users on web version due to traveling)
File stored on SharePoint for simultaneous, multi-user input.
1) I would like it to create the email based on cursor position, instead of being dependent on the user highlighting the row.
2) It needs to create the email utilizing the user's default email client.
a) When I launch it from my desktop, it uses my personal Outlook app instead of my open, Outlook 365 web app.
b) When co-workers use the macro, it works for some and not others. It may be because the email client isn't open or that the code is not looking for Outlook 365 specifically. I really don't know. I just need it to work, regardless, which to me means it needs to look for conditions of the environment and determine what actions need to take place in order to create the email. I have no idea how to do this part.
Please don't judge my code. I know it is very rudimentary and can probably be done more efficiently, but this is what I have so far.
VBA Code:
Sub TASKS_EmailTaskNotification()
Dim OutlookApp As Object: Set OutlookApp = CreateObject("Outlook.Application")
Dim var As Variant: var = Selection.Value
Set MyMail = OutlookApp.CreateItem(0)
With MyMail
.To = var(1, 79)
.CC = var(1, 81)
.Subject = "New Task Assignment:" & " " & var(1, 1) & " -- " & var(1, 7) & " - " & var(1, 13)
.body = "Hello " & var(1, 82) & "," & vbNewLine & vbNewLine & _
"The following task is being brought to your attention for review. Please refer to the FWR Dashboard for additional details." & vbNewLine & vbNewLine & _
"Task ID: " & var(1, 1) & vbNewLine & _
"Date Created: " & var(1, 3) & vbNewLine & _
"Department/Vendor: " & var(1, 5) & vbNewLine & _
"Classification: " & var(1, 7) & vbNewLine & _
"Category: " & var(1, 9) & vbNewLine & _
"Focus: " & var(1, 11) & vbNewLine & vbNewLine & _
"Task Name: " & var(1, 13) & vbNewLine & _
"Description: " & var(1, 15) & vbNewLine & vbNewLine & _
"Details: " & var(1, 17) & vbNewLine & vbNewLine & _
"Priority: " & var(1, 19) & vbNewLine & vbNewLine & _
"Assigned To: " & var(1, 21) & vbNewLine & _
"Assigned By: " & var(1, 23) & vbNewLine & _
"Co-Assigned To: " & var(1, 25) & vbNewLine & _
"Assigned By: " & var(1, 26) & vbNewLine & _
"Co-Assigned Date: " & var(1, 28) & vbNewLine & vbNewLine & _
"Status: " & var(1, 29) & vbNewLine & _
"Dependencies (Task #): " & var(1, 31) & vbNewLine & vbNewLine & _
"Notes: " & var(1, 33) & vbNewLine & vbNewLine & _
"Recommendation(s): " & var(1, 34) & vbNewLine & vbNewLine & _
"Supporting Files 1: " & var(1, 37) & vbNewLine & _
"Supporting Files 2: " & var(1, 38) & vbNewLine & vbNewLine & _
"Latest Status: " & var(1, 42) & vbNewLine & vbNewLine & vbNewLine & vbNewLine & _
"If you have any questions or concerns, please do not hesitate to reach out." & vbNewLine & vbNewLine
End With
MyMail.Display
End Sub
Thank you for help on this!! I have been struggling for weeks. Getting this right means our team can effectively communicate.
Office 365 (some users on web version due to traveling)
File stored on SharePoint for simultaneous, multi-user input.