SpreadsheetGear The Performance Spreadsheet Component Company 
ReadVBA Property
See Also  Example
SpreadsheetGear Namespace > IWorkbookSet Interface : ReadVBA Property
Gets or sets the property which specifies whether VBA Macros should be read when reading a workbook.

Syntax

C# 
virtual bool ReadVBA {get; set;}

Example

C#Copy Code
using System; 
using SpreadsheetGear; 
  
namespace ConsoleApplication 

    /// <summary> 
    /// Demonstrate a custom function which sums the range of cells or values passed to it. 
    /// </summary> 
    class Program 
    { 
        static void Main(string[] args) 
        { 
            // Create a new empty workbook. 
            IWorkbookSet workbookSet = Factory.GetWorkbookSet(); 
  
            // Set to not read VBA or Objects (shapes). 
            workbookSet.ReadVBA = false; 
            workbookSet.ReadObjects = false; 
  
            // Read MyWorkbook.xls without VBA or objects. 
            IWorkbook workbook = workbookSet.Workbooks.Open("MyWorkbook.xls"); 
        } 
    } 

    
Visual BasicCopy Code
Imports System
Imports SpreadsheetGear


Namespace ConsoleApplication
    _
    ' Demonstrate reading a workbook without VBA or objects (shapes).
    Class Program

        Public Overloads Shared Sub Main()
            ' Create a new empty workbook.
            Dim workbookSet As IWorkbookSet = Factory.GetWorkbookSet()

            ' Set to not read VBA or Objects (shapes).
            workbookSet.ReadVBA = False
            workbookSet.ReadObjects = False

            ' Read MyWorkbook.xls without VBA or objects.
            Dim workbook As IWorkbook = workbookSet.Workbooks.Open("MyWorkbook.xls")
        End Sub 'Main
    End Class 'Program
End Namespace 'ConsoleApplication

Remarks

VBA Macros are read and written by default. Set this property to false to disable reading of VBA Macros when a workbook is read.

Note that support for VBA Macros is limited to reading and writing the OLE Compound Document streams. VBA Macros cannot be copied, modified or deleted, and are not updated when worksheets or other objects are copied, modified or deleted.

Requirements

Platforms: Windows Vista, Windows XP, Windows Server 2008, Windows Server 2003, Windows 2000, Windows Me and Windows 98, including 32 bit and 64 bit editions where applicable. SpreadsheetGear for .NET 1.x requires the Microsoft .NET Framework 1.1 or .NET 2.0 (works with .NET 3.x). SpreadsheetGear for .NET 2007 requires the Microsoft .NET Framework 2.0 (works with .NET 3.x).

See Also