SpreadsheetGear 2023
ReadVBA Property (IWorkbookSet)
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
'Declaration
 
Property ReadVBA As System.Boolean
'Usage
 
Dim instance As IWorkbookSet
Dim value As System.Boolean
 
instance.ReadVBA = value
 
value = instance.ReadVBA
System.bool ReadVBA {get; set;}
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.

Example
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");
        }
    }
}
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
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

IWorkbookSet Interface
IWorkbookSet Members
ReadObjects Property