Lalit Bhandry
New Member
Below prog. runs successfully except that email picks up the same details as in first row.
The flags work well, the variable too works well except email sent picks the first row only.
how can the command line be made variable,
Thank you.
The flags work well, the variable too works well except email sent picks the first row only.
how can the command line be made variable,
Code:
strCommand = strCommand & " -compose " & "to=" & Chr(34) & Eadd & Chr(34)
strCommand = strCommand & ",subject=" & Chr(34) & Subj & Chr(34)
strCommand = strCommand & ",body=" & Chr(34) & eBody & Chr(34)
strCommand = strCommand & ",attachment=" & "G:\Staff Reports 2015\Pmail\" & Trim(nam)
Sub Sendout()
'
' op Macro
' Macro recorded by lalit
'
'
A = 5
Dim nam As String
Dim Flag As String
Dim Subj As String
Dim Eadd As String
Dim eBody As String
Tnam = Cells(A, 2).Value
nam = Cells(A, 2).Value
Flag = Cells(A, 1).Value
Subj = Cells(A, 3).Value
Eadd = Cells(A, 4).Value
Eadd1 = Cells(A, 5).Value
eBody = Cells(2, 11).Value
Do While Tnam <> ""
If Flag = "Y" Then
strTh = "C:\Program Files (x86)\Mozilla Thunderbird\Thunderbird.exe "
strCommand = strCommand & " -compose " & "to=" & Chr(34) & Eadd & Chr(34)
strCommand = strCommand & ",subject=" & Chr(34) & Subj & Chr(34)
strCommand = strCommand & ",body=" & Chr(34) & eBody & Chr(34)
strCommand = strCommand & ",attachment=" & "G:\Staff Reports 2015\Pmail\" & Trim(nam)
Shell strTh & strCommand, vbNormalFocus
SendKeys "^+{ENTER}", True
End If
A = A + 1
nam = Cells(A, 2).Value
Flag = Cells(A, 1).Value
Subj = Cells(A, 3).Value
Eadd = Cells(A, 4).Value
Eadd1 = Cells(A, 5).Value
eBody = Cells(2, 11).Value
Tnam = Cells(A, 2).Value
'tesing if variable takes the new value, it does
Workbooks("LB_test.xls").Sheets("Mreco").Activate
ActiveSheet.Cells(A, 15).Select
ActiveCell.FormulaR1C1 = nam
Loop
End Sub
Thank you.
Last edited by a moderator: