SpreadsheetGear
ReadVBA Property
See Also  Example Send Feedback
SpreadsheetGear Namespace > IWorkbookSet Interface : ReadVBA Property

Gets or sets the property which specifies whether VBA Macros should be read when reading a workbook.

Syntax

Visual Basic (Declaration) 
Property ReadVBA As Boolean
C# 
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: x86 and x64 versions of Windows 2000, Windows XP, Windows Vista, Windows 7, Windows Server 2003 (including R2) and Windows Server 2008 (including R2). SpreadsheetGear 2009 requires the Microsoft .NET Framework 2.0 and supports .NET 3.0 and .NET 3.5.

See Also

Copyright © 2003-2009 SpreadsheetGear LLC. All Rights Reserved.Help Powered by Innovasys   
SpreadsheetGear is a registered trademark of SpreadsheetGear LLC.
Microsoft, Microsoft Excel and Visual Studio are trademarks or registered trademarks of Microsoft Corporation.