VbaProjectReferenceCollection.AddProjectRefrernce

VbaProjectReferenceCollection.AddProjectRefrernce method

Adds a reference to an external VBA project.

[Obsolete("Use VbaProjectReferenceCollection.AddProjectReferernce() method instead.")]
[EditorBrowsable(EditorBrowsableState.Never)]
public int AddProjectRefrernce(string name, string absoluteLibid, string relativeLibid)
ParameterTypeDescription
nameStringThe name of reference.
absoluteLibidStringThe referenced VBA project’s identifier with an absolute path.
relativeLibidStringThe referenced VBA project’s identifier with an relative path.

Remarks

NOTE: This method is now obsolete. Instead, please use VbaProjectReferenceCollection.AddProjectReferernce() method. This method will be removed 12 months later since July 2026. Aspose apologizes for any inconvenience you may have experienced.

Examples

using System;
using Aspose.Cells;
using Aspose.Cells.Vba;

namespace AsposeCellsExamples
{
    public class VbaProjectReferenceCollectionMethodAddProjectRefrernceWithStringStringStringDemo
    {
        public static void Run()
        {
            // Create a new workbook
            Workbook workbook = new Workbook();
            
            // Initialize VBA project
            VbaProject vbaProject = workbook.VbaProject;
            
            // Add a project reference with absolute and relative libids
            vbaProject.References.AddProjectRefrernce("MyProject", "absoluteLibid", "relativeLibid");
            
            // Display reference count
            Console.WriteLine("Total References: " + vbaProject.References.Count);
            
            // Save the workbook
            workbook.Save("VbaProjectReferenceExample.xlsm");
        }
    }
}

See Also