If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Error Type: Microsoft VBScript runtime (0x800A000D) Type mismatch

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-23-03, 09:54
vijayalakshmi vijayalakshmi is offline
Registered User
 
Join Date: Aug 2003
Posts: 2
Error Type: Microsoft VBScript runtime (0x800A000D) Type mismatch

Hi,

I am trying to Read the first row of an axcel file and store the fieldnames in an array.

I am doing all this in a class , and I am instantiating this class in main ASP page, where I am calling the public method
Here Is the code:
Code:
<%
Class ExcelReader
	
    'Delcare Excel Application Object,   
    
    Private xlApp
    Private xlWorkbk
    Public intCol
    Public fieldName(50)
    Public Strrow
    
    Public Sub ColumnInfo(FileName)
		
		On Error Resume Next
    
		
		'Create Excel Application Object
		
		
		Dim strFilename
		strFileName = "C:\temp\" & cStr(FileName)
		
		Set xlApp = Server.CreateObject("Excel.Application")
    
		Set xlWorkbk = xlApp.Workbooks.Open(strFileName)
    
		'Retrive the fieldnames in First row into Array
		
		Dim intRow 
		Dim ArrayIndex 
		
 
		intRow = 1
		intCol = 1
		ArrayIndex = 1
		Strrow = "Names of fields"
 
		While (cStr(xlApp.Worksheets("tblScholarYear").Cells.Item(1, intCol).Value) <> "")

                                   ' I am getting error at the below line
		    fieldName(ArrayIndex) = cStr(xlApp.Worksheets("tblScholarYear").Cells.Item(1, intCol).Value)
		    Strrow = Strrow & "   " & cStr(fieldName(ArrayIndex))
		    'Strrow = strrow & "   " & cStr(xlApp.WorkSheets("tblScholars").Cells.Item(1, intCol).Value)
		    intCol = intCol + 1
		    ArrayIndex = ArrayIndex + 1
		Wend
		
		
		'Clean up the Excel Application Object
		
  
		xlWorkbk.Close
		Set xlWorkbk = Nothing
		xlApp.Quit
		Set xlApp = Nothing
					    
    End Sub
    	
End Class
%>
I am getting error when I am trying to assign the cell value to the array.

Can any body help me with this, Please.

Thanks.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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