Sub CreateMailByThunderbird(Addrs As String, body As String)
Dim sPath
With CreateObject("ScriptControl")
.Language = "JScript"
End With
If Application.OperatingSystem = "Windows (32-bit) NT 6.01" Then
sPath = """ C:\Program Files(x86)\Mozilla Thunderbird\Thunderbird.exe"" -compose "
Else
sPath = """C:\Program Files\Mozilla Thunderbird\Thunderbird.exe"" -compose "
End If
arg = "mailto:" & Addrs & "?" & "body=" & body
Shell sPath & arg
Sleep 1000
CreateObject("Wscript.Shell").SendKeys "^{enter}", True
End Sub
So I tried switching the sPath around but it will still have runtime error and made sure the path is correct. The line in red is highlighted when I debug.
Edit
Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Sub Thunderbird_mail()
Dim Addrs As String, body As String, data(4) As String
Toadrs = ThisWorkbook.ActiveSheet.Cells(4, 2) 'Cells(Row number,column number)
'kenmei = ThisWorkbook.ActiveSheet.Cells(14, 3) 'Subject
'Name = ThisWorkbook.ActiveSheet.Cells(21, 3) 'Name
'Purpose = ThisWorkbook.ActiveSheet.Cells(21, 8) 'Purpose
'BookDate = ThisWorkbook.ActiveSheet.Cells(21, 20) 'BookDate
'TimeStart = ThisWorkbook.ActiveSheet.Cells(21, 21) 'TimeStart
'TimeEnd = ThisWorkbook.ActiveSheet.Cells(21, 23) 'TimeEnd
Title_Name = "Name: "
Title_Purpose = "Purpose: "
Title_BookDate = "Book Date: "
Title_TimeStart = "Time Start: "
Title_TimeEnd = "Time End: "
selector = Cells(21, 3).Select
Do Until ActiveCell.Value = ""
ActiveCell.Offset(1, 0).Select
Loop
ActiveCell.Offset(-1, 0).Select
data(0) = ActiveCell
body = Title_Name & Name & "%0a" & Title_Purpose & Purpose & "%0a" & Title_BookDate & BookDate & "%0a" & Title_TimeStart & TimeStart & "%0a" & Title_TimeEnd & TimeEnd
Call CreateMailByThunderbird(Addrs, body)
End Sub
Sub CreateMailByThunderbird(Addrs As String, body As String)
Dim sPath
With CreateObject("ScriptControl")
.Language = "JScript"
End With
If Application.OperatingSystem = "Windows (32-bit) NT 6.01" Then
sPath = """ C:\Program Files(x86)\Mozilla Thunderbird\Thunderbird.exe"" -compose "
Else
sPath = """C:\Program Files\Mozilla Thunderbird\Thunderbird.exe"" -compose "
End If
arg = "mailto:" & Addrs & "?" & "body=" & body
Shell sPath & arg
Sleep 1000
CreateObject("Wscript.Shell").SendKeys "^{enter}", True
End Sub
Bookmarks