I have a program that takes a load of data from sql queries and outputs it to an excel spreadsheet.
myWkBook.Sheets(Row.Item("intTypeSort")).Cells(4, j) = Row.Item("strDescription")
the current variables in the code above are as follows:
J = 2
Row.Item("intTypeSort") = 1
Row.Item("strDescription") = "Missing NiNO (TPR)"
the error that comes up is
HResult=0x80131516 Message=Value was either too large or too small
for a Decimal.
I’m not sure why the error is referring to the value is too large for a decimal when the sql database query is returning a string that is held in a string data field.
the version of excel I have on my machine is version 2406(build17726.20206)
from my company’s 365 apps for enterprise subscription.
following some suggestions from comments I’ve implemented the following code changes
Dim intsheetindex As Integer
Dim stroutputitem As String
intsheetindex = Row.Item("intTypeSort")
stroutputitem = Row.Item("strDescription")
myWkBook.Sheets(intsheetindex).Cells(4, j) = stroutputitem
this has not fixed the problem.
variables contain the following:
j = 2
intsheetindex = 1
stroutputitem = "Missing NiNO (TPR)"
7