When an Array isn't an Array

hatman

Well-known Member
Joined
Apr 8, 2005
Messages
2,664
So I have this custom Type:

Code:
Public Type Shape_Export_Data_Ver_1

    sedName As String
    sedText As String
    sedTop As Double
    sedLeft As Double
    sedWidth As Double
    sedHeight As Double
    sedShadow_Visible As Boolean
    sedShadow_Type As Integer
    sedType As Integer
    sedConnector_BeginShape As String
    sedConnector_EndShape As String
    sedConnector_BeginAnchor As Integer
    sedConnector_EndAnchor As Integer
    sedFont_Color As Integer
    sedFill_Color As Integer
    sedFont_Size As Integer
    sedConnector_Type As Integer
    sedGRIPS() As Double
    
End Type

But when I call the Join Function:

Code:
Dim Dat_Array() As Shape_Export_Data_Ver_1

...

Join(Dat_Array(Cnt).sedGRIPS, "|")

I get the following error:

Runtime Error 5: Invalid Procedure Call or Argument

While the Isarray() function

Code:
IsArray(Dat_Array(Cnt).sedGRIPS)

Returns a True.

So the work around is child's play... yet I'm a little troubled that the original usage doesn't work. Has anyone encountered this, or have some explanation. I assume that it's something to do with the the fact that I have defined an array as a custom type that contains an array, and the interpretter is just getting confused by the recursion...
 
It depends on how many types and the types. It's a judgement call on your part. Here is a snippet of code from one of my applications that saves different types to one file. I have had no problems and it's fast.

Code:
    Open FilePath For Binary Access Write As #1
        x = 2001
        'Put #1, x, PaddingBytes 'reserved the first 2000 bytes for later xsible use
        Put #1, x, CommPortNumber:          x = x + LenB(CommPortNumber)
        Put #1, x, EchoTimeout:             x = x + LenB(EchoTimeout)
        Put #1, x, ClearEncoderPause:       x = x + LenB(ClearEncoderPause)
        Put #1, x, AckNacTimeout:           x = x + LenB(AckNacTimeout)
        Put #1, x, Appearance:              x = x + LenB(Appearance)
        Put #1, x, AppearanceTheme:         x = x + LenB(AppearanceTheme)
        Put #1, x, UsingNetwork:            x = x + LenB(UsingNetwork)
        Put #1, x, LocalPort:               x = x + LenB(LocalPort)
        Put #1, x, WinSockRemoteHost:       x = x + LenB(WinSockRemoteHost)
        Put #1, x, WinSockRemotePort:       x = x + LenB(WinSockRemotePort)
        Put #1, x, WinSockLocalPort:        x = x + LenB(WinSockLocalPort)
        Put #1, x, WindowTop:               x = x + LenB(WindowTop)
        Put #1, x, WindowLeft:              x = x + LenB(WindowLeft)
        Put #1, x, PacketRecievedACKColor:  x = x + LenB(PacketRecievedACKColor)
        Put #1, x, PacketSendingACKColor:   x = x + LenB(PacketSendingACKColor)
        Put #1, x, PacketSentACKColor:      x = x + LenB(PacketSentACKColor)
        Put #1, x, PacketFailedNACColor:    x = x + LenB(PacketFailedNACColor)
        Put #1, x, WatchServerActivity:     x = x + LenB(WatchServerActivity)
        Put #1, x, BP
    Close #1
 
Upvote 0

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.

Forum statistics

Threads
1,215,054
Messages
6,122,893
Members
449,097
Latest member
dbomb1414

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