Only user-defined types defined in public objects modules can be coerced to or from a variant or passed to late-bound functions. What?

PegasusJF

New Member
Joined
Dec 7, 2007
Messages
26
This most inconvient function occourred about this code. It's much longer than this, with a lot of user defined functions, but that's the general area.

_________________________
Dim firstIdx As Integer 'first dimension array idx, and 2nd and 3rd next lines
Dim secondIdx As Integer
Dim thirdIdx As Integer

Dim product As String
Dim ender As Integer
Dim ender3 As Integer

'this double loop loads the all data array
Do While allData(firstIdx, 0, 0) <> "NULL"
product = allData(firstIdx, 0, 0)
secondIdx = 1
thirdIdx = 1
iTimeArray = timeKeeper(iRange, iDateStart, iDateInterval)
ender = arrayEnder

Do While secondIdx <= ender
allData(firstIdx, secondIdx, 0) = iTimeArray(secondIdx) <- This line.
rowArray = dataArrayer(iRange, product, iTimeArray(secondIdx), iShift)
ender3 = arrayEnder

Do While thirdIdx <= ender3
allData(firstIdx, secondIdx, thirdIdx) = rowArray(thirdIdx)
thirdIdx = thirdIdx + 1
If thirdIdx = ender3 Then allData(firstIdx, secondIdx, thirdIdx) = "NULL"
Loop

secondIdx = secondIdx + 1
If secondIdx = ender Then allData(firstIdx, secondIdx, 0) = "NULL"
Loop
firstIdx = firstIdx + 1
Loop
__________________________

TimeKeeper is a function that returns and array with DualDates (code below) and copied to iTimeArray, but then I get this crazy error message.

Only user-defined types defined in public objects modules can be coerced to or from a variant or passed to late-bound functions.

I have no idea what is going on here, and for reference I have my public data declarations and User defined data types.



____________________________
Public arrayEnder As Integer 'each function will use this variable so the "Null" string
'will be at the end of each array in allData

Public allData() As Variant 'This array contains all the data needed,
'the first dimesion will be product names as Strings
'the second will be applicable time intervals as DualDates
'the final will be the relevant data rows as integers

Type DualDate ' A User Defined Datatype with 2 Dates, meant for showing a span of time.
startDate As Date
endDate As Date
End Type

Type DualInt 'for returning row and column coordinates
row As Integer
col As Integer
End Type
___________________________________

any ideas, do I have to rework my entire idea and get rid of the DualDate UDT?

Thanks

PegasusJF
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.

Forum statistics

Threads
1,214,920
Messages
6,122,262
Members
449,075
Latest member
staticfluids

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