Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default How to decide if an excel file has got VBA code in it ?

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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3
Default How to decide if an excel file has got VBA code in it ?

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Open a file with the help of a code in Excel Pranay Shah New Users to Excel 3 August 22nd 07 02:42 PM
How to hide VB code from Excel file Anift Setting up and Configuration of Excel 3 December 19th 06 01:43 PM
Code to Open Excel File Please Help Cole Excel Discussion (Misc queries) 2 July 10th 06 09:04 PM
User to decide how often a macro runs Deedee Excel Discussion (Misc queries) 2 November 2nd 05 08:42 PM
Are alien abductions real? You decide - 1 attachment GordonJ Excel Discussion (Misc queries) 0 October 11th 05 11:03 AM


All times are GMT +1. The time now is 04:35 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"