Array / string type mismatch

vicx2ww

New Member
Joined
Mar 30, 2017
Messages
11
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

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
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
As there are 2 values in your array Your line below:-
Code:
NameCC = CStr(Arr)

should either be 
  NameCC= cstr(Arr(0)) 

for the first value 

Or
 NameCC= cstr(Arr(1)) 

for the second value
 
Upvote 0
Thank you for your reply.
I need both of them to work.
Also when i investigate in lotus notes i found that them mail are read but somehow they are not read properly by lotus.
 
Upvote 0

Forum statistics

Threads
1,215,669
Messages
6,126,125
Members
449,293
Latest member
yallaire64

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top