Results 1 to 2 of 2

Thread: Runtime error, type mismatch.

  1. #1

    Thread Starter
    Addicted Member AmmerBow's Avatar
    Join Date
    Sep 2000
    Posts
    195

    Runtime error, type mismatch.

    I keep getting this error.
    06/27/01 08:35:05 Run time error at line 69. Source: Microsoft VBScript runtime error Error: 800a000d. Description: Type mismatch

    here is the code piece that keeps failing.
    rpc = Replace(objmessage.Text, chr(13), " ",,,vbBinaryCompare)
    rpc = Replace(x(15), chr(10), " ",,,vbBinaryCompare)

    Anyone know why.

    I have included the whole code below.
    Code:
    <SCRIPT RunAt=Server Language=VBScript>
    
    '------------------------------------------------------------------------------
    'FILE DESCRIPTION: Exchange Server Event Script
    '------------------------------------------------------------------------------
    
    Option Explicit 
    
    '------------------------------------------------------------------------------
    ' Global Variables
    '------------------------------------------------------------------------------
    
    '------------------------------------------------------------------------------
    ' Event Handlers
    '------------------------------------------------------------------------------
    
    ' DESCRIPTION: This event is fired when a new message is added to the folder
    Public Sub Folder_OnMessageCreated
        Dim objMessage
        Dim CDOSession
        Set CDOSession = EventDetails.Session  
        Set objMessage = CDOSession.GetMessage(EventDetails.MessageID,Null)
    
    Dim x(20), z
    Dim y
    dim rpc
    
    Const ForReading = 1, ForWriting = 2, ForAppending = 8
    Dim fso, f
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set f = fso.OpenTextFile("\\howbp05\runtimenews$\index.html", 1, True)
    
    Dim fso2, f2
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set f2 = fso.OpenTextFile("\\howbp05\runtimenews$\live.html", 2, True)
    
    Do Until y > 0
    x(0) = f.readline
    f2.writeline x(0)
    y = InStr(1, x(0), "RunTimeTable", vbTextCompare)
    Loop
    
    x(1) = f.readline
    f2.writeline x(1)
    x(2) = f.readline
    f2.writeline x(2)
    x(3) = f.readline
    z = Left(x(3), InStrRev(x(3), Chr(34) & ">", -1, vbTextCompare) + 1)
    f2.writeline z & objmessage.sender & "</FONT></P>"
    x(4) = f.readline
    f2.writeline x(4)
    x(5) = f.readline
    f2.writeline x(5)
    x(6) = f.readline
    z = Left(x(6), InStrRev(x(6), Chr(34) & ">", -1, vbTextCompare) + 1)
    f2.writeline z & objmessage.TimeSent & "</FONT></P>"
    x(7) = f.readline
    f2.writeline x(7)
    x(8) = f.readline
    f2.writeline x(8)
    x(9) = f.readline
    z = Left(x(9), InStrRev(x(9), Chr(34) & ">", -1, vbTextCompare) + 1)
    f2.writeline z & objmessage.subject & "</FONT></P>"
    x(10) = f.readline
    f2.writeline x(10)
    x(11) = f.readline
    f2.writeline x(11)
    x(12) = f.readline
    rpc = Replace(cstr(objmessage.Text), chr(13), " ",,,vbBinaryCompare)
    rpc = Replace(x(15), chr(10), " ",,,vbBinaryCompare)
    z = Left(x(12), InStrRev(x(12), Chr(34) & ">", -1, vbTextCompare) + 1)
    f2.writeline z & x(15) & "</FONT></P>"
    x(13) = f.readline
    f2.writeline x(13)
    x(14) = f.readline
    f2.writeline x(14)
    'end of table line
    
    'append on the orig line.
    f2.writeline x(1)
    f2.writeline x(2)
    f2.writeline x(3)
    f2.writeline x(4)
    f2.writeline x(5)
    f2.writeline x(6)
    f2.writeline x(7)
    f2.writeline x(8)
    f2.writeline x(9)
    f2.writeline x(10)
    f2.writeline x(11)
    f2.writeline x(12)
    f2.writeline x(13)
    f2.writeline x(14)
    
    Do Until f.AtEndOfStream
    x(0) = f.readline
    f2.writeline x(0)
    Loop
    
    objmessage.delete 
    f.Close
    f2.Close
    
    '   Const ForReading = 1, ForWriting = 2, ForAppending = 8
    '    Dim fso, f
    '    Set fso = CreateObject("Scripting.FileSystemObject")
    '    Set f = fso.OpenTextFile("\\howbp05\runtimenews$\live.txt", ForAppending, True)
    'on error resume next
    '    f.WriteLine "BOSender"
    '    f.WriteLine objmessage.sender
    '    f.WriteLine objmessage.subject
    '    f.WriteLine objmessage.TimeSent
    '    f.WriteLine "BOMess"
    '    f.WriteLine objmessage.text
    '    f.WriteLine "EOMess"
    '    f.Close
    '    objmessage.delete
    End Sub
    
    ' DESCRIPTION: This event is fired when a message in the folder is changed
    Public Sub Message_OnChange
    End Sub
    
    ' DESCRIPTION: This event is fired when a message is deleted from the folder
    Public Sub Folder_OnMessageDeleted
    End Sub
    
    ' DESCRIPTION: This event is fired when the timer on the folder expires
    Public Sub Folder_OnTimer
    End Sub
    
    </SCRIPT>
    Amiga 500 was here.

  2. #2
    Addicted Member Merlin's Avatar
    Join Date
    Dec 2000
    Location
    Eau Claire, WI
    Posts
    233
    According to the MSDN ASCII character chart:
    * * Values 8,9,10 an 13, convert backspace, tab, linefeed, and carriage return characters, respectively. They have no graphical representation, but depending on the application, can affect the visual display of the text.
    I am not sure if that is the problem but perhaps you are trying to store something in the array that was defined as a "string" by the first entry therefore making only "string" datatypes. ASCII character 10 has no "string" display equivalent. Just a guess without running the code I can't be sure. If you need a line feed add a vbCrLf to the end of the string you are adding to the array where you want one, that I know works.
    Last edited by Merlin; Jun 27th, 2001 at 12:07 PM.
    poooof

    Wizard Since 1997
    SQL Server 7.0:2K, Oracle, VB 6.0 EE, VBScript, C/C++, COBOL, RPG ILE, HTML, XML, Perl

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width