"The server threw an exception error" when running Excel-to-CSV.Vbs

Page 2 of 2 FirstFirst 12

  1. Posts : 11
    Windows 7 32 and 64 bit (dual boot)
    Thread Starter
       #11

    OK, thanks for your help with this.

    I have tried the new code and it works OK with "True", but when I change it to "False" it returns the same old error: "the server threw an exception" at line 16 this time (in my original script it was at line 17).

    Re: installing Office again, that was the first thing I did when the error came up, and nothing changed: still same error messages, with both Perl and .vbs scripts.
      My Computer


  2. Posts : 721
    Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
       #12

    According to other sources, there may be an issue with this particular COM object in Windows 7 if the object doesn’t have administrative rights. I’m not using Windows 7 to test your script so I can’t tell you if this issue is actually the expected behaviour for this platform.

    Try using an Elevated Command Prompt.


    I’m linking your SO cross post here.
      My Computer


  3. Posts : 11
    Windows 7 32 and 64 bit (dual boot)
    Thread Starter
       #13

    I wonder if using an Elevated Command Prompt would work in a .bat context.

    I need to use this script converter xls to csv from a .bat, I will not type the instruction manually in cmd prompt each time.
      My Computer


  4. Posts : 11
    Windows 7 32 and 64 bit (dual boot)
    Thread Starter
       #14

    Maybe I have found a way to do it:
    Bat To Exe Converter | F2KO Software

    Basically: create a .bat, convert it to an .exe with the above program and then run the .exe as admin.

    I have not tested this yet, I will report if it works or not.

    EDIT: I have tested it and it does not work.
    Basically I have created the .bat containing the following command line as an .exe, then run the .exe as administrator:
    Excel-to-Csv.vbs test.xlsx test.csv

    The Excel-to-Csv.vbs file contains the original code I posted at the start of the thread, the one that gave the error. I still get the same error even if I run it as administrator, when compiled as an .exe.

    So, I guess the issue is somewhere else, the mysteries of Windows 7...
    Last edited by JohnSmithWin7; 27 Jan 2017 at 10:35. Reason: improving comment
      My Computer


  5. Posts : 721
    Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
       #15

    No, no, no. Don’t do that. If you introduce yourself to complications while doing this you’ll just confuse yourself.

    It would seem to me that you are unsure of how to run a VBScript on the command line. But how are you running the script currently then?

    In an Elevated Command Prompt run,
    Code:
    "C:\path\to\Excel-to-CSV.Vbs" "C:\path\to\input.xlsx" "C:\path\to\output.csv"
      My Computer


  6. Posts : 11
    Windows 7 32 and 64 bit (dual boot)
    Thread Starter
       #16

    Currently, I have a .bat that contains several command lines that trigger different scripts (a poor man's way of writing a code, I use it to manipulate a number of Excel files quickly, mostly copy and paste data and perform some calculation, if done manually it would be too long and too tedious while with the .bat is quick and precise).

    For example, my bat could look like this:

    script.pl do this and that operation on file1.xlsx
    ren file1.xlsx file2.xlsx
    excel-to-csv.vbs file2.xlsx file2.csv

    here is where I get stuck: the .vbs command line fails and triggers the error message discussed in this thread.

    How would I run the command line above from within a .bat with an elevated prompt?
      My Computer


  7. Posts : 721
    Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
       #17

    We’re not going to use batch files at all right now, alright? It’s called isolating the problem.

    Just open an elevated CMD and enter commands similar to this.

    Code:
    C:\>cd C:\path\to\folder\containing\execl-to-csv\script
    C:\path\to\folder\containing\execl-to-csv\script>excel-to-csv.vbs file2.xlsx file2.csv

    I’ll have to get back to you later on this.
      My Computer


  8. Posts : 11
    Windows 7 32 and 64 bit (dual boot)
    Thread Starter
       #18

    Pyprohly said:
    In an Elevated Command Prompt run,
    Code:
    "C:\path\to\Excel-to-CSV.Vbs" "C:\path\to\input.xlsx" "C:\path\to\output.csv"
    No worries, so I have run the above from a cmd prompt (run as administrator), changing path to the folder where I have the old/original Excel-to-CSV.Vbs:

    "C:\AT\temp\Excel-to-Csv.vbs" "C:\AT\temp\test.xls" "C:\AT\temp\test.csv"


    The result is the usual error msg: the server threw an exception, etc.
      My Computer


  9. Posts : 11
    Windows 7 32 and 64 bit (dual boot)
    Thread Starter
       #19

    Pyprohly, just wanted to say thanks, your workaround solved somehow the issue. Worksforme.
      My Computer


 
Page 2 of 2 FirstFirst 12

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 07:41.
Find Us