LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default Type Mismatch error

Guys,

Can someone please tell me why I get type mismatch error. The problem line
is:

layer_array = geomsasciiparse()

This line in the Sub below calls out the function named geomsasciiparse
which returns an array.

Any help is appreciated.


Private Sub CommandButton1_Click()
Dim layer_array() As Variant



path1 = MentDesContPath

layer_array = geomsasciiparse()

MsgBox "Done"

End Sub

Public Function geomsasciiparse() As Variant

Dim logical_layer() As Variant
Dim logicallayernumber, arraynumber As Integer

Dim objFSO As Object
Set objFSO = CreateObject("Scripting.FileSystemObject")
Dim objGeomsAsciiFile As Object

'Buf array stores words from each line
Dim Buf() As String

'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)

'need to redim logical_layer so it can be assigned to geomsasciiparse later
ReDim Preserve logical_layer(logicallayernumber)

'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(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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Visual Basic Error Run Time Error, Type Mismatch Meg Partridge Excel Discussion (Misc queries) 12 September 10th 08 06:10 PM
runtime error 13 - type mismatch error in Excel 97 on Citrix Kevin Maher Excel Programming 7 March 8th 08 11:48 AM
Conditional Formatting - Run Time Error '13' Type Mismatch Error ksp Excel Programming 0 July 11th 06 07:06 AM
Help: Compile error: type mismatch: array or user defined type expected lvcha.gouqizi Excel Programming 1 October 31st 05 08:20 PM
Befuddled with For Next Loop ------ Run - Time Error '13' Type Mismatch Error rdavis7408 Excel Programming 1 August 25th 04 03:54 AM


All times are GMT +1. The time now is 06:53 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"