Strange characters in logfile

Posted on 2011-10-12
Last Modified: 2012-05-12

I have a vb script code to write into the logfiles.log, but strangely when the program ran at another PC the rests of the log file is Stange_characters.log

I have print screen the results of the messagebox, so by right what should appear in the messagebox should be written into the logfile...
MsgBox strChanges
Call Write_in_File("C:\transActive\bin\SIG_schematic.txt", strChanges)

End Sub

Function Write_in_File(File, Content)
        Dim newFS
        Dim File_Name
            Set newFS = CreateObject("Scripting.FileSystemObject")
            Set File_Name = newFS.OpenTextFile(File, 8, True)
            File_Name.Write Now & " " & Content & vbCrLf
            Set File_Name = Nothing
            Set newFS = Nothing
End Function

Open in new window

Question by:csharp_learner
    1 Comment
    LVL 9

    Accepted Solution

    It appears for some reason the log file is created using UNICODE character set

    Try changing  

    Set File_Name = newFS.OpenTextFile(File, 8, True)

    Open in new window


     Set File_Name = newFS.OpenTextFile(File, 8, True,0)

    Open in new window


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    This article is the result of a quest to better understand Task Scheduler 2.0 and all the newer objects available in vbscript in this version over  the limited options we had scripting in Task Scheduler 1.0.  As I started my journey of knowledge I f…
    I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
    Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
    This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now