Andresig Posted January 8, 2010 Posted January 8, 2010 Does somebody knows how to set programatically the correct Guid for a VBA Reference Library, I am having problem when running a macro in diferent computer because the have different versions of Excel (2003 and 2007). I read something to set the guid inside excel http://www.vbaexpress.com/kb/getarticle.php?kb_id=267 , but I don'd know how to set it in Autocad. Thanks in advance if somebody can help me. Quote
fixo Posted January 9, 2010 Posted January 9, 2010 Does somebody knows how to set programatically the correct Guid for a VBA Reference Library, I am having problem when running a macro in diferent computer because the have different versions of Excel (2003 and 2007).I read something to set the guid inside excel http://www.vbaexpress.com/kb/getarticle.php?kb_id=267 , but I don'd know how to set it in Autocad. Thanks in advance if somebody can help me. The same way in AutoCAD just add reference I commented below into your project and save them before running Option Explicit ' requre reference to: ' Microsoft Visual Basic For Applications Extensibility 5.3 Sub LoadRef() Dim refs As References Set refs = ThisDrawing.Application.VBE.activeVBProject.References Dim guid As String guid = "{00020905-0000-0000-C000-000000000046}" refs.AddFromGuid guid, 1, 0 Dim ref As Reference 'debug only: For Each ref In refs MsgBox ref.FullPath Next End Sub ~'J'~ Quote
Andresig Posted January 14, 2010 Author Posted January 14, 2010 thanks Fixo ! I disabled the Excel Library and Load it with the routine and works really good!! this is how it looks Private Sub LoadRef() Dim refs Dim ref Set refs = ThisDrawing.Application.VBE.activevbproject.references Dim guid As String guid = "{00020813-0000-0000-C000-000000000046}" 'GUID for Excel On Error Resume Next refs.AddFromGuid guid, 1, 0 If Err.Number <> 0 Then On Error GoTo 0 End If End Sub The only thing is I don't know why doesn't recognize the Reference variables (Dim refs as Reference), everithing else is working good. The same way in AutoCAD just add reference I commented belowinto your project and save them before running Option Explicit ' requre reference to: ' Microsoft Visual Basic For Applications Extensibility 5.3 Sub LoadRef() Dim refs As References Set refs = ThisDrawing.Application.VBE.activeVBProject.References Dim guid As String guid = "{00020905-0000-0000-C000-000000000046}" refs.AddFromGuid guid, 1, 0 Dim ref As Reference 'debug only: For Each ref In refs MsgBox ref.FullPath Next End Sub ~'J'~ Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.