shaolinjehzu
New Member
- Joined
- Jul 29, 2015
- Messages
- 1
I've created a macro in a module in a macro-enabled workbook to send mails to project members based on the macro I found here: Spreadsheet Page Excel Tips: Sending Personalized Email From Excel
There are 3 PC's, all running Office 2010 Professional Plus on Windows 7 with the exact same settings applied (macro and other security settings, references in VBE etc.).
Upon reformatting two of the computers and reinstalling the same Office 2010, the macro doesn't work on those computers anymore, but no error message is displayed either: it runs the full code but ends up doing nothing.
I've rechecked all settings, and also checked if those two computers can run any other macros (all macros beside this one still work); I can not find any difference whatsoever.
Here's the macro:
The macro allows the user to send mails without attachments to all email addresses specified in To, CC and BCC in Windows Live Mail. (Which we use on all 3 computers)
Any idea why it won't work anymore after reinstalling Office? A last solution would be to switch to Outlook, which I know is much more compatible with Office, but I'd rather not...
Thank you in advance for your time.
There are 3 PC's, all running Office 2010 Professional Plus on Windows 7 with the exact same settings applied (macro and other security settings, references in VBE etc.).
Upon reformatting two of the computers and reinstalling the same Office 2010, the macro doesn't work on those computers anymore, but no error message is displayed either: it runs the full code but ends up doing nothing.
I've rechecked all settings, and also checked if those two computers can run any other macros (all macros beside this one still work); I can not find any difference whatsoever.
Here's the macro:
Code:
Option Explicit
Private Declare PtrSafe Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Sub projectname()
Dim Email As String, Subj As String
Dim Msg As String, URL As String
Dim mailcc As String, mailbcc As String
Subj = "subject"
Msg = ""
Msg = Msg & "message line 1," & vbCrLf & vbCrLf
Msg = Msg & "message line 2"
Msg = Msg & vbCrLf & "message line 3"
Subj = Application.WorksheetFunction.Substitute(Subj, " ", "%20")
Msg = Application.WorksheetFunction.Substitute(Msg, " ", "%20")
Msg = Application.WorksheetFunction.Substitute(Msg, vbCrLf, "%0D%0A")
'************************mail addresses**************************************************
Email = "mail1@mail.com"
mailcc = "mail2@mail.com"
mailbcc = "mail3@mail.com"
'Create the URL
URL = "mailto:" & Email & "?cc=" & mailcc & "&bcc=" & mailbcc & "&body=" & Msg & "&subject=" & Subj
'Execute the URL (start the email client)
ShellExecute 0&, vbNullString, URL, vbNullString, vbNullString, vbNormalFocus
End Sub
The macro allows the user to send mails without attachments to all email addresses specified in To, CC and BCC in Windows Live Mail. (Which we use on all 3 computers)
Any idea why it won't work anymore after reinstalling Office? A last solution would be to switch to Outlook, which I know is much more compatible with Office, but I'd rather not...
Thank you in advance for your time.