Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Guys,
I am looking for a way to decide whether an excel file has got some VBA code in it? How can i achieve this without opening the excel file and macros. I have a set of excel files in my organisation and need to filter all the excel files which has got some VBA code inside it. I am probably looking for creating a tool in c# to do this automation. So if anyone of you have any knowledge of c# classes to access office components like excel that will be helpful. Many Thanks in advance, -- SKP |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
On Aug 4, 4:33*pm, Sujit wrote:
Guys, I am looking for a way to decide whether an excel file has got some VBA code in it? How can i achieve this without opening the excel file and macros. I have a set of excel files in my organisation and need to filter all the excel files which has got some VBA code inside it. I am probably looking for creating a tool in c# to do this automation. So if anyone of you have any knowledge of c# classes to access office components like excel that will be helpful. Many Thanks in advance, -- SKP This is the case: Every XLS file is in fact OLE2 Compound File/Document, also called " COM/OLE structured storage" (http://en.wikipedia.org/wiki/ Structured_storage). That file internally contains streams of data with various parts of XLS file. If there is a stream called "_VBA_PROJECT_CUR" inside XLS file, you can be sure it contains VBA code. In other words, open file as OLE2 Compound Document and check stream names for macro stream name. In C# you can open OLE2 Compound Documents using our GemBox.CompoundFile component (http:// www.gemboxsoftware.com/CompoundFile.htm, Free version is size limited). There you also have viewer for OLE2 Compound Files. For new XLSX file format, check is trivial. If the file contains macros, it has extension .XLSM. If you want to remove Macros from XLS file, you can use our GemBox.Spreadsheet Excel component (http://www.gemboxsoftware.com/ GBSpreadsheet.htm) and deselect Preserve when loading the file (http:// http://www.gemboxsoftware.com/help/G...sOptions.html). And, of course, you can use Excel Automation/interop, which has its drawbacks (http://www.gemboxsoftware.com/GBSpre...htm#Automation) but it supports ALL features of Excel file formats. Hope I helped, -- Zeljko |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to Open a file with the help of a code in Excel | New Users to Excel | |||
How to hide VB code from Excel file | Setting up and Configuration of Excel | |||
Code to Open Excel File Please Help | Excel Discussion (Misc queries) | |||
User to decide how often a macro runs | Excel Discussion (Misc queries) | |||
Are alien abductions real? You decide - 1 attachment | Excel Discussion (Misc queries) |