Home » excel » c# – convert xls to xlsm using excelcnv.exe

c# – convert xls to xlsm using excelcnv.exe

Posted by: admin April 23, 2020 Leave a comment


i had create one console application. and use the microsoft ppcnvcom.exe, excelcnv.exe, wordconv.exe to convert the doc to docx, xls to xlsx and ppt to pptx.

but can anyone know this how to convert xls to xlsm?

OFC.exe is the one choice but when i called it from sharepoint it not converted successfully.some security issu is block the converter. OFC.exe automatically identify if xls have a macro in it then it convert to xlsm file.

but i want this using excelcnv.exe ?

have any idea?

How to&Answers:

Unfortunately, no, you can’t do this with excelcnv.exe as it requires a file name. It would be wonky to name all your .xls files as .xlsm and then go through 1 by 1 to figure out which ones don’t have macros.

Based on your comments, you’ve tried using OFC.exe, which is a much better way of going about this for what you’re looking for. We should focus efforts on that instead. What exactly is the error you are receiving and how are you configuring your .INI file? (see http://blogs.msdn.com/b/ericwhite/archive/2008/09/19/bulk-convert-doc-to-docx.aspx for an example).

You have to use the Process class to run OFC.exe and then pass in the right command line arguments to point to your INI file.

EDIT: 2011-03-11:
I guess if no more details are forthcoming to help troubleshoot this, I’ll stick by the answer in the first paragraph as answering the OP’s question: …you can’t do this with excelcnv.exe as it requires a file name.


You could try: http://sourceforge.net/projects/b2xtranslator/ instead