0 Replies - 300 Views - Last Post: 04 October 2012 - 07:06 PM Rate Topic: -----

#1 infotechmike  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 04-October 12

Error Description Overflow From String Variables?

Posted 04 October 2012 - 07:06 PM

Function autoCreateTicker goes to the error handler and returns an Overflow error, but I don't understand as my string variables are small.

Option Explicit
Dim lastId As Long
Dim offset As Long

Function autoCreateTicker(symbol, secType, currencyCode, row) As Boolean
    Dim server As String
    Dim topic As String
    Dim id As String
    Dim reqType As String
    Dim desc As String
    Dim logSuccess As Boolean
    Dim counter As Integer
    
    ' default the user entered fields
    Worksheets("Tickers").Range("A" & CStr(row)).value = symbol
    Worksheets("Tickers").Range("B" & CStr(row)).value = secType
    Worksheets("Tickers").Range("G" & CStr(row)).value = "SMART"
    Worksheets("Tickers").Range("I" & CStr(row)).value = currencyCode
    
    ' validate
    If symbol = "" Or secType = "" Or currencyCode = "" Then
        autoCreateTicker = False
        Exit Function
    End If
    
    ' build server
    server = Worksheets("Tickers").Range("B5").value
    If server = "" Then
        autoCreateTicker = False
        Exit Function
    End If
    server = "=" & server
    On Error GoTo tik_ErrorHandler ' Returns an "Overflow" error at this point.
    
    ' set topic
    topic = "tik"

    ' create and set id
    id = makeId()
    
    If Not composeTickerRequest(reqType, desc, symbol, secType, "", "", "", "", "SMART", currencyCode) Then
        autoCreateTicker = False
        Exit Function
    End If
    
' But spreadsheet seems to work to this point...	
	
    Worksheets("Tickers").Range("K" & CStr(row)).value = server & "|" & topic & "!'" & id & "?" & reqType & "?" & desc & "'"
    Worksheets("Tickers").Range("N" & CStr(row)).value = server & "|" & topic & "!" & id & "?bidSize"
    Worksheets("Tickers").Range("O" & CStr(row)).value = server & "|" & topic & "!" & id & "?bid"
    Worksheets("Tickers").Range("P" & CStr(row)).value = server & "|" & topic & "!" & id & "?ask"
    Worksheets("Tickers").Range("Q" & CStr(row)).value = server & "|" & topic & "!" & id & "?askSize"
    Worksheets("Tickers").Range("T" & CStr(row)).value = server & "|" & topic & "!" & id & "?last"
    Worksheets("Tickers").Range("U" & CStr(row)).value = server & "|" & topic & "!" & id & "?lastSize"
    Worksheets("Tickers").Range("X" & CStr(row)).value = server & "|" & topic & "!" & id & "?high"
    Worksheets("Tickers").Range("Y" & CStr(row)).value = server & "|" & topic & "!" & id & "?low"
    Worksheets("Tickers").Range("Z" & CStr(row)).value = server & "|" & topic & "!" & id & "?volume"
    Worksheets("Tickers").Range("AA" & CStr(row)).value = server & "|" & topic & "!" & id & "?close"
    
    logSuccess = logMessage("[autoCreateTicker]", "Ticker created for: " & symbol)
    
    autoCreateTicker = True
    Exit Function
	tik_ErrorHandler:
        autoCreateTicker = False
        logSuccess = logMessage("[autoCreateTicker]", "An automated ticker request was attempted, but could not be created for: " & symbol & ".  Error description: " & Err.Description)
End Function



Is This A Good Question/Topic? 0
  • +

Page 1 of 1