Hi all
I am new here
I try to optimise my work and i get a very strange error.
Macro is about sending mails via lotus notes, the error that i get is referring to Array/String type mismatch.
Everything seems to work fine until it gets to CC recipients, there are a dynamic number of them , now i am testing version with 2 of them. variant with 1 CC recipient is working.
error i get on the line NameCC = CStr(Arr), i tried to pass the array option ,with using specific cells not ranges like (NameCC = Sheets("Pivot").Cells(i, 6).Value & ";" & Sheets("Pivot").Cells(i, 7).Value)
but it works only for the first CC recipient.
Please advice where is my mistake.
PS: texts bodies versions are in a separate function that i call at the end
Thank you in advance
I am new here
I try to optimise my work and i get a very strange error.
Macro is about sending mails via lotus notes, the error that i get is referring to Array/String type mismatch.
Everything seems to work fine until it gets to CC recipients, there are a dynamic number of them , now i am testing version with 2 of them. variant with 1 CC recipient is working.
error i get on the line NameCC = CStr(Arr), i tried to pass the array option ,with using specific cells not ranges like (NameCC = Sheets("Pivot").Cells(i, 6).Value & ";" & Sheets("Pivot").Cells(i, 7).Value)
but it works only for the first CC recipient.
Please advice where is my mistake.
PS: texts bodies versions are in a separate function that i call at the end
Code:
Sub test1()Dim i As Integer
Dim VMail As String
Dim Subject As String
Dim Vcc As String
Dim Vcc1 As String
Dim VBcc As String
Dim Curr As String
Dim Key As String
Dim NameCC As String
'Dim Arr(Sheets("Pivot").Cells(i, 6).Value, Sheets("Pivot").Cells(i, 7).Value) As String
Dim Arr As Variant
DateT = Sheets("Pivot").Range("A1").Value
For i = Sheets("Pivot").Range("h2").Value To Sheets("Pivot").Range("i2").Value
Name = Sheets("Pivot").Cells(i, 2).Value
VTotal = Sheets("Pivot").Cells(i, 3).Value
VMail = Sheets("Pivot").Cells(i, 5).Value
' Vcc = Sheets("Pivot").Cells(i, 7).Value
[U] Arr = Array(Sheets("Pivot").Cells(i, 6).Value, Sheets("Pivot").Cells(i, 7).Value)[/U]
[U] NameCC = CStr(Arr)[/U]
' Vcc1 = Sheets("Pivot").Cells(i, 6).Value
VBcc = Sheets("Pivot").Cells(i, 4).Value
XFileName = Sheets("Pivot").Cells(i, 8).Value
Curr = Sheets("Pivot").Cells(i, 9).Value
Key = Sheets("Pivot").Cells(i, 1).Value
If (Right(Sheets("Pivot").Cells(i, 1).Value, 3) = "50-") Then
Subject = "Kind Reminder - less than 50 days outstanding " & Key
Call sendmail50less(Subject, VMail, "", VBcc, NameCC)
End If
If (Right(Sheets("Pivot").Cells(i, 1).Value, 3) = "50+") Then
Subject = "Reminder - over 50 days outstanding " & Key
Call sendmail50more(Subject, VMail, "", VBcc, NameCC)
End If
If (Right(Sheets("Pivot").Cells(i, 1).Value, 3) = "60+") Then
Subject = "Final Notice- over 60 days outstanding " & Key
Call sendmail60more(Subject, VMail, "", VBcc, NameCC)
End If
Next i
End Sub
Thank you in advance