Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default VBA---Tools--References automatic

Good day everyone,

Is it possible through VBA in the Workbook open to add an instruction
in order to make sure that the "Microsoft Forms 2.0 Object Library" is
entered..

In the VBA window, you must click on Tools, then References and then
click on the "Microsoft Forms 2.0 Object Library"

I'd like this to be automated..... I tried:

Private Sub Workbook_Open()
VB(References("Microsoft Forms 2.0 Object Library")).Installed
= True

Does not work... Also played around with the paranthesis.... Did not
work either...

If someone knows, I would appreciate.

Thanks for your time

Denys

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default VBA---Tools--References automatic

http://support.microsoft.com/default.aspx?kbid=213529
XL2000: How to Programmatically Create a Reference

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Denys" wrote in message
ps.com...
Good day everyone,

Is it possible through VBA in the Workbook open to add an instruction
in order to make sure that the "Microsoft Forms 2.0 Object Library" is
entered..

In the VBA window, you must click on Tools, then References and then
click on the "Microsoft Forms 2.0 Object Library"

I'd like this to be automated..... I tried:

Private Sub Workbook_Open()
VB(References("Microsoft Forms 2.0 Object Library")).Installed
= True

Does not work... Also played around with the paranthesis.... Did not
work either...

If someone knows, I would appreciate.

Thanks for your time

Denys



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default VBA---Tools--References automatic

Watch for the word wrap -

With ThisWorkbook.VBProject.References
.AddFromFile ("C:\WINDOWS\SYSTEM\MSForms.TWD")
End with

'Cant be sure if that's the correct ref though...


--
---
HTH
Roger
Shaftesbury (UK)
(Excel 2003, Win XP/SP2)

"Denys" wrote in message
ps.com...
Good day everyone,

Is it possible through VBA in the Workbook open to add an instruction
in order to make sure that the "Microsoft Forms 2.0 Object Library" is
entered..

In the VBA window, you must click on Tools, then References and then
click on the "Microsoft Forms 2.0 Object Library"

I'd like this to be automated..... I tried:

Private Sub Workbook_Open()
VB(References("Microsoft Forms 2.0 Object Library")).Installed
= True

Does not work... Also played around with the paranthesis.... Did not
work either...

If someone knows, I would appreciate.

Thanks for your time

Denys



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default VBA---Tools--References automatic

One more, the example is generic so adapt to add the reference to
ThisWorkbook in the open event.

Sub test()
Dim wb as Workbook
Dim objRef As Object ' Reference


Set wb = Workbooks("Book5") ' change

With wb.VBProject.References
On Error Resume Next
Set objRef = .Item("MSForms")
On Error GoTo 0
If objRef Is Nothing Then
Set objRef = .AddFromGuid("{0D452EE1-E08F-101A-852E-02608C4D0BB4}", 0, 0)
End If
End With

' MsgBox objRef.Name
End Sub

I can't think why you would ever need to do this as the reference is saved
with the workbook. If you have programmatically added code to some other
workbook, then add the reference at the same time.

Regards,
Peter T

"Denys" wrote in message
ps.com...
Good day everyone,

Is it possible through VBA in the Workbook open to add an instruction
in order to make sure that the "Microsoft Forms 2.0 Object Library" is
entered..

In the VBA window, you must click on Tools, then References and then
click on the "Microsoft Forms 2.0 Object Library"

I'd like this to be automated..... I tried:

Private Sub Workbook_Open()
VB(References("Microsoft Forms 2.0 Object Library")).Installed
= True

Does not work... Also played around with the paranthesis.... Did not
work either...

If someone knows, I would appreciate.

Thanks for your time

Denys



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default VBA---Tools--References automatic

Good afternoon everyone,

Thank you very much for your time. Peter T, your solution is perfect
works like a charm !!!!

Have a nice day ..

Denys

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Tools | References AA2e72E Excel Programming 2 May 18th 06 10:28 AM
VBE ToolsReferences Bill Martin[_2_] Excel Programming 2 February 24th 06 01:17 AM
Tools...References shows "MISSING:" in front of 2 references Mike Jamesson Excel Programming 1 October 19th 05 06:33 PM
Tools>References greyed out Atchoum Excel Discussion (Misc queries) 3 March 4th 05 12:24 AM
Tools | References - information about references L Mehl Excel Programming 6 July 4th 04 06:28 PM


All times are GMT +1. The time now is 12:03 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"