Class VbaProjectReference

VbaProjectReference class

Represents the reference of VBA project.

public class VbaProjectReference

Properties

NameDescription
ExtendedLibid { get; set; }Gets and sets the extended Libid of the reference.
Libid { get; set; }Gets and sets the Libid of the reference.
Name { get; set; }Gets and sets the name of the reference.
RelativeLibid { get; set; }Gets and sets the referenced VBA project’s identifier with an relative path.
Twiddledlibid { get; set; }Gets and sets the twiddled Libid of the reference.
Type { get; }Gets the type of this reference.

Methods

NameDescription
Copy(VbaProjectReference)

Examples


[C#]

//Instantiating a Workbook object
Workbook workbook = new Workbook();
 // Init VBA project.
VbaProject vbaProject = workbook.VbaProject;
// Add vba project reference
vbaProject.References.AddRegisteredReference("stdole", "*\\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\\Windows\\system32\\stdole2.tlb#OLE Automation");
//Saving the Excel file
workbook.Save("book1.xlsm");

 [Visual Basic]

'Instantiating a Workbook object
Dim workbook As Workbook = New Workbook()
'Init VBA project.
Dim vbaProject as VbaProject  = workbook.VbaProject
'Add vba project reference
vbaProject.References.AddRegisteredReference("stdole", "*\\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\\Windows\\system32\\stdole2.tlb#OLE Automation")
'Saving the Excel file
workbook.Save("book1.xlsm")

See Also