Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default GUID of the Reference

I am trying to write a macro to add a VB Project reference. By using

NewWorkbook.VBProject.References.AddfromGuid("Guid ","Major","Minor")

Now how can I find the the GUID, major and minor of the reference that I trying to add? By the way, I am trying to add "Microsoft Visual Basic for Applications Extensibility" and my version is Excel 97.

Thanks,
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default GUID of the Reference

Try the following:

ThisWorkbook.VBProject.References.AddFromGuid _
GUID:="{0002E157-0000-0000-C000-000000000046}", _
major:=5, minor:=0


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Anson" wrote in message
...
I am trying to write a macro to add a VB Project reference. By

using


NewWorkbook.VBProject.References.AddfromGuid("Guid ","Major","Mino
r")

Now how can I find the the GUID, major and minor of the

reference that I trying to add? By the way, I am trying to add
"Microsoft Visual Basic for Applications Extensibility" and my
version is Excel 97.

Thanks,



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default GUID of the Reference

Add it manually, then query the reference for its GUID using VBA. I think
you can use 0 and 0 for the major and minor and it will use the latest.

Sub GetGUID()
For Each ref In ThisWorkbook.VBProject.References
Debug.Print ref.Name, ref.GUID
Next
End Sub


produced:
VBA {000204EF-0000-0000-C000-000000000046}
Excel {00020813-0000-0000-C000-000000000046}
stdole {00020430-0000-0000-C000-000000000046}
Office {2DF8D04C-5BFA-101B-BDE5-00AA0044DE52}
MSForms {0D452EE1-E08F-101A-852E-02608C4D0BB4}
VBIDE {0002E157-0000-0000-C000-000000000046}

where the last one is what you want (but do it in Excel 97 - it might be
different)


or
Sub GetGUID()
For Each ref In ThisWorkbook.VBProject.References
Debug.Print ref.Name, ref.GUID, ref.Major, ref.Minor
Next
End Sub


VBA {000204EF-0000-0000-C000-000000000046} 4 0
Excel {00020813-0000-0000-C000-000000000046} 1 3
stdole {00020430-0000-0000-C000-000000000046} 2 0
Office {2DF8D04C-5BFA-101B-BDE5-00AA0044DE52} 2 1
MSForms {0D452EE1-E08F-101A-852E-02608C4D0BB4} 2 0
VBIDE {0002E157-0000-0000-C000-000000000046} 5 3



--
Regards,
Tom Ogilvy

"Anson" wrote in message
...
I am trying to write a macro to add a VB Project reference. By using

NewWorkbook.VBProject.References.AddfromGuid("Guid ","Major","Minor")

Now how can I find the the GUID, major and minor of the reference that I

trying to add? By the way, I am trying to add "Microsoft Visual Basic for
Applications Extensibility" and my version is Excel 97.

Thanks,



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default GUID of the Reference

They worked beautifully! Thanks!

"Anson" wrote:

I am trying to write a macro to add a VB Project reference. By using

NewWorkbook.VBProject.References.AddfromGuid("Guid ","Major","Minor")

Now how can I find the the GUID, major and minor of the reference that I trying to add? By the way, I am trying to add "Microsoft Visual Basic for Applications Extensibility" and my version is Excel 97.

Thanks,

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
Create A GUID Derek Hart Excel Worksheet Functions 3 December 24th 07 01:30 AM
Error setting GUID reference Amit Shanker Excel Programming 7 May 16th 04 04:51 PM
Setting GUID reference error Amit Shanker Excel Programming 0 May 15th 04 02:33 PM
.dll and GUID Ross[_7_] Excel Programming 0 May 12th 04 03:56 PM
Possible to generate a GUID in Excel? Dan[_29_] Excel Programming 2 January 6th 04 06:30 AM


All times are GMT +1. The time now is 02:22 AM.

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"