conception_native_0123
Well-known member
- Local time
- Today, 03:05
- Joined
- Mar 13, 2021
- Messages
- 1,917
i getting this error for no reason.  my return variable a variant like microsoft says to do here
	
	
		
			
				
					
						 
					
				
			
			
		
	
this is all my code on combo box. and my file attached. what am i doing wrong? thank you.
	
	
	
		
  
					
				this is all my code on combo box. and my file attached. what am i doing wrong? thank you.
		Code:
	
	
	Private Sub Choose_Change()
Dim tChoice As String
Dim numPos As Long
Dim endResponse As Long
Dim lenResponse As Long
Dim nChoice As String
Dim iName As String
Dim rMessage As Variant
Dim sMessage As String
Const errMessage1 As String = "No name was entered.  Please try again."
Const response As String = "RESPONSE"
Const space As String = " "
tChoice = cmbChoose.Value
lenResponse = Len(response)
numPos = InStr(lenResponse, tChoice, " ") + 1
nChoice = Mid(tChoice, numPos, 1)
  If nChoice = "3" Then
InputName:
    iName = InputBox("Please enter the name of who you want to send the template to...", "Input")
      If iName = "" Then
        MsgBox errMessage1, vbCritical, "Error"
        GoTo InputName
      End If
  End If
    rMessage = WorksheetFunction.VLookup(tChoice, responses.Range("a:b"), 2, False)
      If Not IsError(rMessage) Then
        sMessage = CStr(rMessage)
        sMessage = Replace(sMessage, "[name]", StrConv(iName, vbProperCase))
        main.preview = sMessage
      Else
        GoTo err
      End If
        Exit Sub
err:
  MsgBox "An error occurred during the routine.  Details are as follows:" & Chr(10) & Chr(10) & _
         "Error Number: " & err.Number & Chr(10) & _
         "Description: " & err.Description, vbCritical, "Error"
End Sub 
	 
 
		 
 
		 
 
		
 
 
		 
 
		 
 
		 
 
		