Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sort of fixed it.
The error (Can't enter break mode at this time.) only occurs if you are stepping through the code, if you just let it run it appears to be fine. I am still playing so will see. Anyway thanks everyone for your input. -- Trefor "Tom Ogilvy" wrote: Yep, that's what I have been doing OK, I guess you threw me off when you posted: This works, . . . ThisWorkbook.VBProject.References.AddFromFile "C:\DataCollectMaster.xla" I have no idea what would cause that message. I don't believe it is specifically associated with adding a reference From what I could find, it was suggested that you Turn off the "Require Variable Declaration" in tools=Options in the editor Tab in the VBE. You can still manually put Option Explicit at the top of each module. Let me know if that works. -- Regards, Tom Ogilvy "Trefor" wrote in message ... Yep, that's what I have been doing and it does work, but it also gives me a message as discribed earlier. -- Trefor "Tom Ogilvy" wrote: Yep, the Project name is: "DataCollectMaster" The file name is "Customer Data Collect Master.xla" based on that information you should be using the filename: ThisWorkbook.VBProject.References _ .AddFromFile "C:\Customer Data Collect Master.xla" -- Regards, Tom Ogilvy "Trefor" wrote in message ... Tom, Yep, the Project name is: "DataCollectMaster" The file name is "Customer Data Collect Master.xla" -- Trefor "Tom Ogilvy" wrote: 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 |