Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Is it possible to code the adding of a refernce (VBE - Tools Refernce)? Is
it also possible to remove this reference? -- Trefor |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Trefor:
If you adding of a refernce "Microsoft Office Outlook 11.0 Object Library" you can remove this reference: With ThisWorkbook.VBProject Set Ref = .References("Outlook") ' Ref.Name If Not Ref Is Nothing Then .References.Remove Ref End If End With you can list all reference For Each Ref In ThisWorkbook.VBProject.References i = i + 1 Cells(i, 1) = Ref.Name Cells(i, 2) = Ref.GUID Cells(i, 3) = Ref.Major Cells(i, 4) = Ref.Minor Cells(i, 5) = Ref.FullPath Cells(i, 6) = Ref.Description Next Ref -- http://www.vba.com.tw/plog/ "Trefor" wrote: Is it possible to code the adding of a refernce (VBE - Tools Refernce)? Is it also possible to remove this reference? -- Trefor |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Trefor:
If you want to adding of a refernce "Microsoft Office Outlook 11.0 Object Library" With ThisWorkbook.VBProject On Error Resume Next Set Ref = .References("Outlook") If Err = 0 Then 'Remove of a Outlook refernce .References.Remove Ref Else 'adding of a Outlook refernce ThisWorkbook.VBProject.References.AddFromGuid _ "{00062FFF-0000-0000-C000-000000000046}", 1, 0 End If End With -- http://www.vba.com.tw/plog/ "Trefor" wrote: Is it possible to code the adding of a refernce (VBE - Tools Refernce)? Is it also possible to remove this reference? -- Trefor |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Chijanzen,
Thankyou for your reply. The reference is for my add-in so: With ThisWorkbook.VBProject Set Ref = .References("DataCollectMaster") ' Ref.Name If Not Ref Is Nothing Then .References.Remove Ref <-- Can't enter break mode at this time. End If End With I get the above error, otherwise the reference did get removed. can you show me how to code adding this add-in by its name? -- Trefor "chijanzen" wrote: Trefor: If you want to adding of a refernce "Microsoft Office Outlook 11.0 Object Library" With ThisWorkbook.VBProject On Error Resume Next Set Ref = .References("Outlook") If Err = 0 Then 'Remove of a Outlook refernce .References.Remove Ref Else 'adding of a Outlook refernce ThisWorkbook.VBProject.References.AddFromGuid _ "{00062FFF-0000-0000-C000-000000000046}", 1, 0 End If End With -- http://www.vba.com.tw/plog/ "Trefor" wrote: Is it possible to code the adding of a refernce (VBE - Tools Refernce)? Is it also possible to remove this reference? -- Trefor |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Trefor:
' adding of a DataCollectMaster Addin refernce ThisWorkbook.VBProject.References.AddFromFile "C:\DataCollectMaster.xla" ' Remove References With ThisWorkbook.VBProject For i = 1 To .References.Count If .References(i).Name = "DataCollectMaster" Then .References.Remove .References(i) End If Next i End With -- http://www.vba.com.tw/plog/ "Trefor" wrote: Chijanzen, Thankyou for your reply. The reference is for my add-in so: With ThisWorkbook.VBProject Set Ref = .References("DataCollectMaster") ' Ref.Name If Not Ref Is Nothing Then .References.Remove Ref <-- Can't enter break mode at this time. End If End With I get the above error, otherwise the reference did get removed. can you show me how to code adding this add-in by its name? -- Trefor "chijanzen" wrote: Trefor: If you want to adding of a refernce "Microsoft Office Outlook 11.0 Object Library" With ThisWorkbook.VBProject On Error Resume Next Set Ref = .References("Outlook") If Err = 0 Then 'Remove of a Outlook refernce .References.Remove Ref Else 'adding of a Outlook refernce ThisWorkbook.VBProject.References.AddFromGuid _ "{00062FFF-0000-0000-C000-000000000046}", 1, 0 End If End With -- http://www.vba.com.tw/plog/ "Trefor" wrote: Is it possible to code the adding of a refernce (VBE - Tools Refernce)? Is it also possible to remove this reference? -- Trefor |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Chijanzen,
This works, but gives me the same error as before (Can't enter break mode at this time.) ThisWorkbook.VBProject.References.AddFromFile "C:\DataCollectMaster.xla" The remove reference works fine thankyou. -- Trefor "chijanzen" wrote: Trefor: ' adding of a DataCollectMaster Addin refernce ThisWorkbook.VBProject.References.AddFromFile "C:\DataCollectMaster.xla" ' Remove References With ThisWorkbook.VBProject For i = 1 To .References.Count If .References(i).Name = "DataCollectMaster" Then .References.Remove .References(i) End If Next i End With -- http://www.vba.com.tw/plog/ "Trefor" wrote: Chijanzen, Thankyou for your reply. The reference is for my add-in so: With ThisWorkbook.VBProject Set Ref = .References("DataCollectMaster") ' Ref.Name If Not Ref Is Nothing Then .References.Remove Ref <-- Can't enter break mode at this time. End If End With I get the above error, otherwise the reference did get removed. can you show me how to code adding this add-in by its name? -- Trefor "chijanzen" wrote: Trefor: If you want to adding of a refernce "Microsoft Office Outlook 11.0 Object Library" With ThisWorkbook.VBProject On Error Resume Next Set Ref = .References("Outlook") If Err = 0 Then 'Remove of a Outlook refernce .References.Remove Ref Else 'adding of a Outlook refernce ThisWorkbook.VBProject.References.AddFromGuid _ "{00062FFF-0000-0000-C000-000000000046}", 1, 0 End If End With -- http://www.vba.com.tw/plog/ "Trefor" wrote: Is it possible to code the adding of a refernce (VBE - Tools Refernce)? Is it also possible to remove this reference? -- Trefor |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Does your xla have a unique project name or is it still the default
vbaProject? If it is, try changing it. -- Regards, Tom Ogilvy "Trefor" wrote in message ... Chijanzen, This works, but gives me the same error as before (Can't enter break mode at this time.) ThisWorkbook.VBProject.References.AddFromFile "C:\DataCollectMaster.xla" The remove reference works fine thankyou. -- Trefor "chijanzen" wrote: Trefor: ' adding of a DataCollectMaster Addin refernce ThisWorkbook.VBProject.References.AddFromFile "C:\DataCollectMaster.xla" ' Remove References With ThisWorkbook.VBProject For i = 1 To .References.Count If .References(i).Name = "DataCollectMaster" Then .References.Remove .References(i) End If Next i End With -- http://www.vba.com.tw/plog/ "Trefor" wrote: Chijanzen, Thankyou for your reply. The reference is for my add-in so: With ThisWorkbook.VBProject Set Ref = .References("DataCollectMaster") ' Ref.Name If Not Ref Is Nothing Then .References.Remove Ref <-- Can't enter break mode at this time. End If End With I get the above error, otherwise the reference did get removed. can you show me how to code adding this add-in by its name? -- Trefor "chijanzen" wrote: Trefor: If you want to adding of a refernce "Microsoft Office Outlook 11.0 Object Library" With ThisWorkbook.VBProject On Error Resume Next Set Ref = .References("Outlook") If Err = 0 Then 'Remove of a Outlook refernce .References.Remove Ref Else 'adding of a Outlook refernce ThisWorkbook.VBProject.References.AddFromGuid _ "{00062FFF-0000-0000-C000-000000000046}", 1, 0 End If End With -- http://www.vba.com.tw/plog/ "Trefor" wrote: Is it possible to code the adding of a refernce (VBE - Tools Refernce)? Is it also possible to remove this reference? -- Trefor |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to make a button VBA code reference other VBA code subroutines??? | Excel Programming | |||
Hard Code DLL Reference in VBA | Excel Programming | |||
Code Reference Problem | Excel Programming | |||
remove reference via code | Excel Programming | |||
Reference a Column in Code | Excel Programming |