VBScript mismatch error

Discussion in 'Programming' started by stevek, Jan 11, 2007.

  1. #1
    Hi,

    I have a question regarding a vbscript I'm trying to write. I'm new to this forum (and vbscripting) so forgive me if I am not in the right place.

    Anyway my query is that I'm running the script I have posted blow and I keep getting a Type Mimatch error as follows:

    Line: 6
    Char: 1
    Error: Type mismatch:'CreateObject_'
    Code: 800A000D

    I have googled the code and have checked the script as suggested there and I can't see anything wrong with line 6 character 1. Can anyone tell me what the error is?

    Thanks

    Dim objFSO
    Dim objFile
    Dim myLine
    Dim entry

    set objFSO = CreateObject_("Scripting.FileSystemObject")
    set objFile = objFSO.OpenTextFile_("logfile.txt", 1, 0)

    rowNum = 2

    do until objFile.AtEndOfStream
    myLine = objFile.ReadLine()

    ' Use the split function to divide the
    ' string userID, status and date+time

    entry = split(myLine, ":", 3, 1)

    ' Now split entry(2) into date and time fields.
    ' Time is of the form HH:MM
    ' For date, remove last five characters
    ' For time, select last five characters


    mydate = Left(entry(2), Len(entry(2)) - 5)
    mytime = Right(entry(2), 5)

    app.Cells(rowNum, 1).Value = entry(0)
    app.Cells(rowNum, 2).Value = entry(1)
    app.Cells(rowNum, 3).Value = mydate
    app.Cells(rowNum, 4).Value = mytime

    rowNum = rowNum + 1
    loop
     
    stevek, Jan 11, 2007 IP
  2. quaffapint

    quaffapint Active Member

    Messages:
    299
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    58
    #2
    Get rid of the underscore, like this...
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    ...(also get rid of the other one).
     
    quaffapint, Jan 11, 2007 IP
  3. stevek

    stevek Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thank you, quaffapint, that has worked.:)
     
    stevek, Jan 11, 2007 IP