Vba library reference

Vba library reference DEFAULT

At some point you may run into a situation when your Excel tool needs to interact with other office application. For example sending an email via Outlook, export output to Word or PowerPoint, upload data to Access etc.

Each program has its own object model, in order to work with other application Excel has to create a link to the other application’s object library via binding. In VBA automation there are two types of binding early binding and late binding. Both of them have their advantages and disadvantages , in the below table I collected the main ones (without attempting to be comprehensive, for more details simply search in Google):

 DescriptionEarly bindingLate binding
Version dependencyDependentNot dependent
Use of IntellisenseYesNo
Use of built-in constantsYesNo

At first look it seems that Early binding beats Late binding except in version dependency. It is really hard to tell if not impossible which approach to use. Usually it depends on the circumstances, if you are 100% sure that users are going to use your tool on a computer which has the same parameters as yours then go for early binding. It makes your life easier during development, code is more readable.  In case of the slightest chance that your code might be used on ‘unknown ‘ computer choose late binding. Or if you have no information about the IT infrastructure you can go with the mixed solutions presented at the end of this article :).

Adding Object Library reference manually via VBE -> Tools -> References

Open VBE editor -> ‘Tools’ menu -> Select ‘References’ -> Search for the desired Object Library -> Put a tick in the check box and click ‘Ok’

Example of Early binding (Word)

It requires Word Object Library, without having it the below error message will pop-up:

So let’s see an easy example how to create a new Word document from Excel with Early binding:

Sub createWordDocEarlyBinding() Dim appWord As Word.Application Dim wordDoc As Document 'Create a new instance of Word Set appWord = New Word.Application 'Make it visible appWord.Visible = True'Add a new document Set wordDoc = appWord.Documents.Add 'Enter some text to the document wordDoc.Paragraphs(1).Range.Text = "Hello I am a new Word document - Early Binding."EndSub

Example of Late binding (Word)

The same example using Late binding:

Sub createWordDocLateBinding() Dim appWord AsObjectDim wordDoc AsObject'Create a new instance of Word Set appWord = CreateObject("Word.Application") 'Make it visible appWord.Visible = True'Add a new document Set wordDoc = appWord.Documents.Add 'Enter some text to the 1st paragraph document wordDoc.Paragraphs(1).Range.Text = "Hello I am a new Word document - Late Binding."EndSub

Early vs Late binding

At first look there is not a big difference between the two (only in creating a new instance of Word), but the early binding version solely works in Excel 2016, while the late binding version does not care about the version number.

Other differences come up you are writing your code in case of early binding you can count on VBA Intellisense help:

In case of late binding Intellisense does not work, you have to know the properties, methods etc. by heart or look them up.

Additional inconvenience you can not use built-in constants. For example if you copy over an Excel range to a Word table and you would like the table to Autofit Window:

  • Early binding: wordTable.AutoFitBehavior (wdAutoFitWindow)
  • Late binding: wordTable.AutoFitBehavior (2), you have to search for the exact value of the constant, for example in the object browser:

Summarizing Early binding makes your life easier, but you are doomed if your application is used in an earlier version of Office. Fortunately there is a solution to mix the two binding making your tool version independent and enjoy the benefits of Intellisense and built-in constants.

Example file: AddRemoveListObjectLibraryReferences.xlsm

Most common Office Programs’ GUID & how to add object libraries

It is possible to add Object Library via VBA either referencing to the file directly  containing it. (You can look up the relevant file –> VBE –> Tools –> References –> select the references and check its location (if it is not visible hold the mouse over the location until you see the pop-up box)

Other approach is to add object library by its GUID (Globally Unique Identifier). One of the biggest advantage of using the GUID is that it is constant and does not change with the version of the program. For example Microsoft Word GUID is: {00020905-0000-0000-C000-000000000046} and it is the same in Word 2010, Word 2013, Word 2016 etc. I am almost 100% sure there are other ways to add an object library, from now on I am focusing on adding object library by GUID.

Most common Office GUID:

Microsoft Excel {00020813-0000-0000-C000-000000000046}
Microsoft Word {00020905-0000-0000-C000-000000000046}
Microsoft PowerPoint {91493440-5A91-11CF-8700-00AA0060263B}
Microsoft Access {4AFFC9A0-5F99-101B-AF4E-00AA003F0F07}
Microsoft Outlook {00062FFF-0000-0000-C000-000000000046}

How to work with Object Library references via VBA

First of all to make your life easier I suggest to add Microsoft Visual Basic for Application Extensibility Library reference to your project. If you do not add it you can not use the ‘Reference’ variable type and you have to declare your reference variable as an Object or Variant. Of course you can add this Object Library via VBA too (see Add Object Library reference to VBAProject programmatically).

Function to check if reference is already added by its GUID

As a first step I suggest to double-check if an object library reference is already added or not, since if it is already added and you try to add it again your code will stop with the below error message:

F_isReferenceAdded function checks if an Object Library is already added as reference by its GUID. It is a boolean function returns TRUE if Object Library reference is already added and FALSE if it is not.

' ---------------------------------------------------------------- ' Purpose: Check if an Object Library refernce is added to a VBAProject or not ' ---------------------------------------------------------------- Function F_isReferenceAdded(referenceGUID AsString) AsBooleanDim varRef AsVariant'Loop through VBProject references if input GUID found return TRUE otherwise FALSE ForEach varRef In ThisWorkbook.VBProject.REFERENCES If varRef.GUID = referenceGUID Then F_isReferenceAdded = TrueExitForEndIfNext varRef EndFunction

Add Object Library reference to VBAProject programmatically

It is simple two steps and you only need to know the GUID of the object library:

  1. check if the VBAProject has already have a particular reference (F_isReferenceAdded function)
  2. if not add the Object Library reference
' ---------------------------------------------------------------- ' Purpose: Add Object Library reference by its GUID ' ---------------------------------------------------------------- Sub addObjectLibraryReference() Dim strGUID AsString'Microsoft Visual Basic For Application Extensibility GUID strGUID = "{0002E157-0000-0000-C000-000000000046}"'Check if reference is already added to the project, if not add it If F_isReferenceAdded(strGUID) = FalseThen ThisWorkbook.VBProject.REFERENCES.AddFromGuid strGUID, 0, 0EndIfEndSub

The References.AddFromGuid method requires three parameters:

  1. guid – string expression
  2. major – long, the major version number of the reference
  3. minor – long, the minor version number of the reference

By using 0 as major and 0 as minor VBA will add the latest available reference.

Remove Object Library reference programmatically

Similarly to add a reference I suggest to check first if the reference is existing in the VBAProject using the F_isReferenceAdded function.

To remove a reference you need to use the References.Remove method, it requires one argument a Reference object that represents the reference you wish to remove. Since I am focusing on GUID at first we need to identify the reference by its GUID, it is obvious I am using a function for that task.

The F_idReferenceByGUID function returns a reference object identified by its GUID:

' ---------------------------------------------------------------- ' Purpose: Return Object Library reference as object, found by its GUID ' ---------------------------------------------------------------- Function F_idReferenceByGUID(referenceGUID AsString) AsObjectDim varRef AsObjectForEach varRef In ThisWorkbook.VBProject.REFERENCES If varRef.GUID = referenceGUID ThenSet F_idReferenceByGUID = varRef ExitForEndIfNext varRef EndFunction

To remove a reference our tool has to perform three steps:

  1. check if the VBAProject has already have a particular reference (F_isReferenceAdded function)
  2. if yes then get reference object (F_idReferenceByGUID)
  3. remove the reference
' ---------------------------------------------------------------- ' Purpose: Remove Object Library Reference ' ---------------------------------------------------------------- Sub removeObjectLibraryReference() Dim strGUID AsString'Microsoft Visual Basic For Application Extensibility GUID strGUID = "{0002E157-0000-0000-C000-000000000046}"'Check if reference is already added to the project, if yes remove If F_isReferenceAdded(strGUID) = TrueThen ThisWorkbook.VBProject.REFERENCES.remove F_idReferenceByGUID(strGUID) EndIfEndSub

Loop through and list references in VBA project

Easiest way to get an object library GUID is to add the reference manually then run the below code it lists the reference name and GUID in the Immediate Window.

' ---------------------------------------------------------------- ' Purpose: List Object Library Name and Guid ' ---------------------------------------------------------------- Sub listAddedObjectLibrariesGUID() Dim ref AsObject'Note: No 'Microsoft Visual Basic For Application Extensibility' needed 'Loop through each added reference and print their Name & GUID into the immediate window ForEach ref In ThisWorkbook.VBProject.REFERENCES Debug.Print "Name: ", ref.Name Debug.Print "GUID: " & ref.GUID Debug.Print Next ref EndSub

If you are interested in the source file of an object library use Reference.FullPath property.

Example file: EarlyAndLateBindingExample.xlsm

Apply early binding and still make your tool version independent

To achieve this you have to be careful when you are writing your program, but it is feasible. There are certain rules you have to follow though:

  1. add the object library manually your program requires 
  2. write your code using early binding
  3. call your object library procedure in a separate procedure
  4. before the calling add the object library via VBA
  5. after the calling remove the object library via VBA

As result you will have a version independent, but still easy to maintain program.

Let’s take an example. In the example we create a Word document, add some text to a paragraph and format the paragraph.

' ---------------------------------------------------------------- ' Purpose: Add Microsoft Word Object Library, call a procedure using that library, then remove Word Object Library ' ---------------------------------------------------------------- Sub callingProcedureMSWordObjLibrary() Dim strGUID AsString'Microsoft Word GUID strGUID = "{00020905-0000-0000-C000-000000000046}"'Check if reference is already added to the project, if not add it If F_isReferenceAdded(strGUID) = FalseThen ThisWorkbook.VBProject.REFERENCES.AddFromGuid strGUID, 0, 0EndIf'Calling the procedure using Word object library Call procedureUsingMSWordObjectLibrary 'Check if reference is added to the project, if yes remove If F_isReferenceAdded(strGUID) = TrueThen ThisWorkbook.VBProject.REFERENCES.Remove F_idReferenceByGUID(strGUID) EndIfEndSub' ---------------------------------------------------------------- ' Purpose: Create new Word document with early binding, add two paragraphs, align the 2nd one to center ' ---------------------------------------------------------------- Sub procedureUsingMSWordObjectLibrary() Dim appWord As Word.Application Dim wordDoc As Document 'Create a new instance of Word Set appWord = New Word.Application 'Make it visible appWord.Visible = True'Add a new document Set wordDoc = appWord.Documents.Add 'Enter some text to the 1st paragraph of the document, add new paragraph, add some text to 2nd paragraph wordDoc.Paragraphs(1).Range.Text = "Hello I am a new Word document created 'semi' early binding." wordDoc.Paragraphs.Add wordDoc.Paragraphs(2).Range.Text = "I am MS Office version independent."'Align 2nd paragraph to center (in late binding it would look like: ' wordDoc.Paragraphs(2).Format.Alignment = 1) wordDoc.Paragraphs(2).Format.Alignment = wdAlignParagraphCenter EndSub' ---------------------------------------------------------------- ' Purpose: Check if an Object Library refernce is added to a VBAProject or not ' ---------------------------------------------------------------- Function F_isReferenceAdded(referenceGUID AsString) AsBooleanDim varRef AsVariant'Loop through VBProject references if input GUID found return TRUE otherwise FALSE ForEach varRef In ThisWorkbook.VBProject.REFERENCES If varRef.GUID = referenceGUID Then F_isReferenceAdded = TrueExitForEndIfNext varRef EndFunction' ---------------------------------------------------------------- ' Purpose: Return Object Library reference as object, found by its GUID ' ---------------------------------------------------------------- Function F_idReferenceByGUID(referenceGUID AsString) AsObjectDim varRef AsObjectForEach varRef In ThisWorkbook.VBProject.REFERENCES If varRef.GUID = referenceGUID ThenSet F_idReferenceByGUID = varRef ExitForEndIfNext varRef EndFunction

As a final step do not forget to remove the object library before release.

It is also Worth to mention Compile your project while you have the object library added, otherwise you get ‘User-defined type not defined’ error message:

Example available below at the ‘Download(s)’ section.

Download(s):

UsingEarlyBindingKeepVersionIndependency.xlsm

Tested:

  • Windows 10/Office 365 – Excel 2016 (32-bit)

Related link(s):

Copy Excel range to a Word table

Display range of cells on a Userform

Loop through Outlook emails with VBA

Related

Categories EXCEL VBA, Object LibrarySours: https://www.excelcise.org/add-or-remove-object-library-reference-via-vba/

Add a library reference to VBA project in workbook

In Microsoft Excel, you can add a library reference to the VBA project by clicking the Tools > References… manually. It will open the following dialog box which will help you to select from existing references or browse your library yourself.

todo:image_alt_text

But sometimes, you need to add or register the library reference to the VBA project through code. You can do it using Aspose.Cells VbaProject.getReferences().addRegisteredReference() method.

Add a library reference to VBA project in workbook

The following sample code adds or registers two library references to the VBA project of the workbook using VbaProject.getReferences().addRegisteredReference() method.

Sours: https://docs.aspose.com/cells/java/add-a-library-reference-to-vba-project-in-workbook/
  1. Cars for sale in islamabad
  2. Mtb project
  3. Kawasaki z900 forums

Check or add an object library reference

If you use the objects in other applications as part of your Visual Basic application, you may want to establish a reference to the object libraries of those applications. Before you can do that, you must first be sure that the application provides an object library.

To see if an application provides an object library

  1. From the Tools menu, choose References to display the References dialog box.

  2. The References dialog box shows all object libraries registered with the operating system. Scroll through the list for the application whose object library you want to reference. If the application isn't listed, you can use the Browse button to search for object libraries (*.olb and *.tlb) or executable files (*.exe and *.dll on Windows). References whose check boxes are selected are used by your project; those that aren't selected are not used, but can be added.

To add an object library reference to your project

  • Select the object library reference in the Available References box in the References dialog box and choose OK. Your Visual Basic project now has a reference to the application's object library. If you open the Object Browser (press F2) and select the application's library, it displays the objects provided by the selected object library, as well as each object's methods and properties.

    In the Object Browser, you can select a class in the Classes box and select a method or property in the Members box. Use copy and paste to add the syntax to your code.

See also

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.

Sours: https://docs.microsoft.com/en-us/office/vba/language/how-to/check-or-add-an-object-library-reference
reference missing error fix using in excel - vba late binding - vbatip#20

How to Add an Object Library Reference in VBA

Outlook Data Recovery, Outlook Solutions October 10, 2017

In Outlook VBA editor, if you desire to use the objects of other applications, such as Microsoft Excel or Word, you have to add the according object library references in the first place. This article will share you the concrete steps.

To start with, you could access the Outlook VBA editor either by pressing “Alt + F11” keys or clicking on the “Visual Basic” button in the “Developer” ribbon. Then, you can follow the steps below to establish the reference to your wanted objects. Here we take “Microsoft Excel Object Library” as an instance.

  1. In VBA editor window, click the “Tools” button in the menu bar.
  2. Then, from the drop down list, select the “References” option.Select "References" Option from "Tools" Drop Down List
  3. Subsequently, the “References – Project 1” dialog box will display.
  4. In this dialog box, you can pull the scrolling bar down until you locate what you want, such as “Microsoft Excel 14.0 Object Library”.Enable Your Wanted Object Library
  5. After that, mark the checkbox in front of this object.
  6. Finally, click “OK”.
  7. From now on, you have added the Excel object library reference successfully.
  8. Since then, you can make use of the objects in MS Excel at will.

You can follow the steps above to add the other object libraries as per your needs.

Author Introduction:

Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including corrupt mdf and outlook repair software products. For more information visit www.datanumen.com

Sours: https://www.datanumen.com/blogs/add-object-library-reference-vba/

Reference vba library

References

You can reference object libraries to make their objects available in your code (Tools > References).
Any references to external object libraries are saved within the individual file.
Before you can use any functions, objects, methods or properties from external object libraries you must add a reference to them first.


If you plan to control other programs from your Office application you will have to add the necessary reference.


AddFromFile
AddFromGuid
Remove


For code in one project to call code in another project the calling project must have a reference to the calling project.
This list also includes references to any other object libraries and any ActiveX controls installed on your computer.
This list contains files that have been automatically registered in the Registry will appear automatically.



Early Binding

we are binding the external object library to our application at design-time
Using early binding gives the following benefits:

  • The code is much faster, as all the links between the libraries have already been checked and compiled.

  • The New operator can be used to create instances of the external objects.

  • All of the constants defined in the object library can be utilised therefore avoiding magic numbers.

  • Excel displays the Auto List Members, Auto Quick Info and Auto Data Tips information for the objects while the application is being developed.


However this of course one major disadvantage
If you try and run an application on a computer that does not have all the external object libraries installed you will get a compile-time error which cannot be trapped using normal methods.


Late Binding

If the reference is not listed you can select the "Browse" button to add an additional file.
If the library isn't listed then it is flagged as "MISSING".


MISSING

If any of the references are missing then it will not find any references
SS
You can browse for object libraries (.olb and .tlb) or executables (.exe and .dll). Sometimes you can find you have "Missing" references.
Assuming that it is not required deselect it and choose (Debug > Compile Project).


All the boxes with checks against them denote the Object libraries that are currently available to your project.


Object Browser

Any references you add to your project will automatically get added to the libraries drop down list in the Object Browser.


Common Functions


Function NameDescription
URLDownloadFileDownloads bits from the internet and saves them as a file
FindWindowRetrieves a handle to the top level window with a specific class name
SetWindowLongChanges an attribute of a specified window
DrawMenuBarRedraws the menubar on a specified window
GetWindowLongRetrieves information about a specified window

© 2021 Better Solutions Limited. All Rights Reserved. © 2021 Better Solutions LimitedTopPrevNext
Sours: https://bettersolutions.com/vba/visual-basic-editor/references.htm
Excel VBA Topic 2.5 - Absolute vs Relative References in VBA

VBA Libraries


Libraries add pre-defined code structures (such as functions, subroutines among others) in a simple and easy way.

In the VBA context, a library usually allows access to new objects and functions.


Standard Libraries

Libraries that are enabled by default when opening Excel:

Standard Libraries
  1. Excel – This is a collection of classes available in Excel, allowing you to work with worksheets objects E.g. workbooks, spreadsheets, ranges, etc...
  2. Office – It is a generic class collection for all Office suite applications, allowing you to work with Office objects in general E.g. command bar, help, etc...
  3. stdole – It is the standard collection of the OLE class, it allows exchange of information between applications
  4. VBA – It is the class collection that allows functions to be used E.g. MsgBox, InputBox, string functions, etc...
  5. VBAProject – It is the local collection for the active workbook, (E.g. spreadsheets, users, etc...)

Class: is what defines the structure of a given object (E.g. for class Range we have objects like Range("A1"), Range("C2:B5"), and so on).


Enabling Libraries

To access, enable and disable libraries in VBA:

  1. In Excel, open the VBE (Alt+F11)
  2. On the Menu Bar, click Tools
  3. Select References... (the References – VBAProject dialog box will be displayed)
  4. Select the desired libraries
  5. Click OK
Enabling Libraries

To add a library that is not in the list, use the button and select the file of the new library.

Enabling additional libraries allows you to develop codes that communicate with other applications and processes. E.g. Word, Outlook, DAO (Data Access Objects), ADOdb (Active Data Objects database), etc...

When we refer to a library in the code but forget to enable it, the following error message is displayed:

Librarie Not Defined

Object Browser

The Object Browser allows you to view the list of all the different objects, methods, and properties of the enabled libraries.

To search the libraries:

  1. Click on the Object Browser icon on the toolbar ()
  2. Select the library you want to view on the dropdown menu
  3. Navigate the library
Object Browser

When in doubt, the Microsoft Help button () can elucidate the utility of the selected element.


VBA Early Binding vs Late Binding

You can use structures from a library without enabling it. This procedure is called Late Binding.

Usually for the Late Binding a variable is declared as an object and later associated with CreateObject.

When we enable a library to access its structures we are performing what is called Early Binding.

In the example case the Outlook library was enabled ().


Early & Late Binding Differences

Early: From the point of view of code development and performance time, Early Binding is more suitable because it allows you to use Excel intellisense ( + ) as well as the library object browser.

Late: Regarding compatibility errors, mainly due to the use of different versions of Excel (which changes the version of the libraries), Late Binding is more indicated.

Intellisense: is an aid, mainly to autocomplete the code, with useful information ( + ).

Intellisense

So, to gain practice with the libraries, try to write the code with Early Binding and later change it into Late Binding.



SuperExcelVBA.com is learning website. Examples might be simplified to improve reading and basic understanding. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. All Rights Reserved.

Excel ® is a registered trademark of the Microsoft Corporation.

© 2021 SuperExcelVBA | ABOUT

Protected by Copyscape

Thank you for contributing. A message was sent reporting your comment.

Sours: https://www.superexcelvba.com/en/tutorial/030-libraries

Now discussing:

VBA references - list, add & remove


In this module - how to programmatically:

  1. List available VBA references
  2. Add VBA references to the project
  3. Delete VBA references from the project

0. VBA References


The VBA reference list (figure 1) can be accessed by the VBE menu sequence. The Available References list displays each reference item by its description property, in priority order.


VBA reference list

References are also part of the libraries drop-down in the Object Browser (figure 2). Each selected reference list item is shown by its name property, in alphabetical order, in the Object Browser.


VBA object browser libraries

1. VBA References - List


Code 1 uses the Reference object and its associated References collection, to print a list of available references. This code requires the Microsoft Visual Basic for Applications Extensibility 5.3 reference.



Code 1:macro print reference list to immediate window Sub xlfVBEListReferences() ' Requires References :: Microsoft Visual Basic for Applications Extensibility 5.3 ' C:\Program Files (x86)\Common Files\Microsoft Shared\VBA\VBA6\VBE6EXT.OLB Dim oRef As VBIDE.Reference ' Item Dim oRefs As VBIDE.References ' Collection Dim i As Integer Set oRefs = Application.VBE.ActiveVBProject.References Debug.Print "Print Time: " & Time & " :: Item - Name and Description" For Each oRef In oRefs i = i + 1 Debug.Print "Item " & i, oRef.Name, oRef.Description Next oRef Debug.Print vbNewLine i = 0 Debug.Print "Print Time: " & Time & " :: Item - Full Path" For Each oRef In oRefs i = i + 1 Debug.Print "Item " & i, oRef.FullPath Next oRef Debug.Print vbNewLine i = 0 ' List the Globally Unique Identifier (GUID) for each library referenced in the current project Debug.Print "Print Time: " & Time & " :: Item - GUID" For Each oRef In oRefs i = i + 1 Debug.Print "Item " & i, oRef.GUID Next oRef Debug.Print vbNewLine End Sub

About Code 1

  1. Line 14:Debug.Print - for each reference, print the Item number, Name and Description properties to the Immediate Window
  2. Line 22:Debug.Print - for each reference, print the Item number, and FullPath property to the Immediate Window
  3. Line 31:Debug.Print - for each reference, print the Item number, GUID (Globally Unique Identifier) property to the Immediate Window

  4. See figure 3 for the Immediate Window details

references sample 9

Reference objects, Items 1 and 9, are expanded in the Locals Window view of Figure 4 as the oRefs object from code 1.


add references guid locals

2. VBA References - Add


The Reference items can be created in the References Collection with the AddFromFile (code 2a) or AddFromGuid (code 2b) methods.



Code 2a:macro add a Reference object to the References collection Sub xlfVBEAddReferences() Dim oRefs As References Set oRefs = Application.VBE.ActiveVBProject.References On Error GoTo OnError oRefs.AddFromFile "C:\Windows\System32\msxml6.dll" OnError: End Sub
Code 2b:macro add a Reference object to the References collection Sub xlfVBEAddReferencesGUID() Dim oRefs As References Set oRefs = Application.VBE.ActiveVBProject.References On Error GoTo OnError ' Syntax: AddFromGuid(Guid, Major, Minor) ' The Major version number of the reference. ' The Minor version number of the reference. ' Microsoft XML, v6.0 :: Major - 6, Minor - 0 oRefs.AddFromGuid "{F5078F18-C551-11D3-89B9-0000F81FE221}", 6, 0 OnError: End Sub

3. VBA References - Remove


To remove an item from the collection, loop through with For Each ... Next, and identify specific objects by Name (code 3a) or Description (code 3b) then Remove.



Code 3a:macro - reference name version Sub xlfVBERemoveReference1() Dim oRef As Reference Dim oRefs As References Set oRefs = Application.VBE.ActiveVBProject.References For Each oRef In oRefs If oRef.Name = "MSXML2" Then oRefs.Remove oRef Exit For End If Next oRef End Sub
Code 3b:macro - reference description version Sub xlfVBERemoveReference2() Dim oRef As Reference Dim oRefs As References Set oRefs = Application.VBE.ActiveVBProject.References For Each oRef In oRefs If oRef.Description = "Microsoft XML, v6.0" Then oRefs.Remove oRef Exit For End If Next oRef End Sub

  • This example was developed in Excel 365 :: VBA 7.1
  • Published: 16 July 2020
  • Revised: Saturday 25th of July 2020 - 09:21 AM, [Australian Eastern Standard Time (EST)]



Sours: https://excelatfinance.com/xlf20/xlf-vba-references.php


516 517 518 519 520