Home |
Search |
Today's Posts |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Actually, there were more errors. In the function, you need to declare your
array as that, not as a variant. Also, you cannot redim preserve without having first dimmed. Public Function geomsasciiparse() As Variant Dim logical_layer() As string ' This is not a variant, it is an array of strings. Dim logicallayernumber, arraynumber As Integer ' You are just declaring arraynumber as an integer, logicallayernumber is a variant Dim objFSO As Object Set objFSO = CreateObject("Scripting.FileSystemObject") Dim objGeomsAsciiFile As Object 'Buf array stores words from each line Dim Buf() As String Redim logical_layer(0) ' You cannot redim preserve without first dimming the array (the preserve comes later) 'opening geoms_ascii file as read only from Mentor Design Container Set objGeomsAsciiFile = objFSO.OpenTextFile(path1 & "\geoms_ascii", 1) Do While Not objGeomsAsciiFile.AtEndOfStream strLine = objGeomsAsciiFile.Readline 'look for first instance of _LAYER_DEFNITION in geoms_ascii If InStr(strLine, "_LAYER_DEFINITION") 0 Then Buf() = qc_Split(strLine) 'extract logical layer number from ARTWORK_01_LAYER_DEFNITION logicallayernumber = Mid(Buf(1), 9, 2) ' This is now a string due to use of mid function 'need to redim logical_layer so it can be assigned to geomsasciiparse later ReDim Preserve logical_layer(CInt(logicallayernumber)) ' You can't redim using a string as parameter 'ignore when ARTWORK_LAYER_DEFINITION = 00 in geoms_ascii If logicallayernumber < "00" Then For buf_idx = 1 To UBound(Buf) If InStr(Buf(buf_idx), "SIGNAL") < 0 Or _ InStr(Buf(buf_idx), "POWER") < 0 Then logical_layer(CInt(logicallayernumber)) = Buf(buf_idx) Exit For End If Next End If End If Loop geomasasciiparse = logical_layer objGeomsAsciiFile.Close End Function |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Visual Basic Error Run Time Error, Type Mismatch | Excel Discussion (Misc queries) | |||
runtime error 13 - type mismatch error in Excel 97 on Citrix | Excel Programming | |||
Conditional Formatting - Run Time Error '13' Type Mismatch Error | Excel Programming | |||
Help: Compile error: type mismatch: array or user defined type expected | Excel Programming | |||
Befuddled with For Next Loop ------ Run - Time Error '13' Type Mismatch Error | Excel Programming |