1. Remove the
ByRef
and replace with
ByVal
.
Function GetNewsletterHeader(ByVal Ix As Int16) As String
2. Ensure that
Ix
is declared as Int16 in the scope of the
For..Next
loop
3. In the
Function GetNewsLetterHeader
, add the following line
Dim myItem as string
4. Change the assignment to
myItem
to
myItem = "Item" & Ix.ToString
5. Add the following line as the very first line of the Visual Studio document file that contains this code
Option Strict
6. Let us know which line gets the error and what the Visual Studio Debugger displays for the values of the variables that are involved in the error.