CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 2004
    Location
    POLAND, Lodz
    Posts
    20

    VBA - changing encoding of the imported CSV file

    Hi there,

    I have a very disturbing problem.

    I need to import CSV file into Excel. The file is generated dynamically and I have no possibility to change the way it's done.

    When I import the data into my Excel SpreadSheet either by opening it as CSV or by using QueryTables some specific for my language letters are substituted by "?". the CSV file itself also contens that letter insted of the proper ones.

    Could You suggest any way I can change the encoding via VBA while importing the file ?

    Thank You for any suggestion

  2. #2
    Join Date
    Nov 2004
    Location
    LA. California Raiders #1 AKA: Gangsta Yoda™
    Posts
    616

    Re: VBA - changing encoding of the imported CSV file

    If the output csv file is containing the "?" in its data then its your source program's issue of it not supporting unicode characters or some other issue. But once its written to the text file csv it may not be recoverable.

    Try a test by copying a "?" character from the output'd csv file and in VB's immediate window type ?asc(" and then paste the "?" copied character right next to the double quote and then type ") to complete it.

    ?Asc("?")

    Should be what it should look like. Then press enter at the end of that line to see if it outputs the original character code or if it outputs the question marks character code of 63. If you get anything other then 63 then you can recover the characters by changing the import type encoding.
    VB/Office Guru™ (AKA: Gangsta Yoda™)
    VB Forums - Super Moderator 2001-Present

    Microsoft MVP 2006-2011

    Please use [code]your code goes in here[/code] tags when posting code.

    Senior Software Engineer MCP, BSEE, CET
    VS 2012 Premium, VS 6.0 Enterprise SP6, VSTO, Office Ultimate 2010, Windows 7 Ultimate
    Star Wars Gangsta Rap SE Reputations & Rating Posts Office Primary Interop AssembliesAdvanced VB/Office Guru™ Word SpellChecker™.NETAdvanced VB/Office Guru™ Word SpellChecker™ VB6Outlook Global Address ListVB6/Crystal Report Ex.VB6/CR Print Setup Dialog Ex.

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

Featured