Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Add Remove DLL reference in VB

Further to my previous post on the 10th, i have a few
questions/results to post,

i find it impossible to remove any reference without an
error coming up. I used the following code:

On Error Resume Next
Application.DisplayAlerts = False
With ThisWorkbook.VBProject.References
.Remove .Item("ProgressIndicator")
Debug.Print Err.Number
End With
Application.DisplayAlerts = True
On Error GoTo 0

Application.DisplayAlerts = False
ThisWorkbook.VBProject.References.AddFromFile
("c:\ProgressIndicator.dll")
Application.DisplayAlerts = True

So, in the first instance i delete the reference and then i
add it up again. Please note that in the current procedure
i do not use the dll, the dll is used from another procedure.

So, there are two cases one in which the dll is already
referenced and one in which it is not.

Suppose that it is referenced, then the code in deleteing
the reference comes up with "Can't enter break mode at this
time" and the options "continue" or "end only" are
possible. So i used debug.print err.number to get the error
number, which is zero!

If its not referenced then it goes smoothly through the
"deletion" routine (as there is nothing to delete) and
again comes up with "Can't enter break mode at this time"
"continue" or "end" options. Now, here the strangest thing
happens, i click on end and i have a look at the
references, and the code has added a reference to
"ProgressIndicator.dll" but not on "C:\" but rather on
"C:\windows\System32\". I really don't get and of course
the "ProgressIndicator.dll" does not reside on system32...

I am a bit perplexed, sorry for the big post,
Thanks a lot for your replies,
rgrds,
Alex



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,236
Default Add Remove DLL reference in VB

Are you stepping through (debugging) the code?

--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Alex" wrote in message
...
Further to my previous post on the 10th, i have a few
questions/results to post,

i find it impossible to remove any reference without an
error coming up. I used the following code:

On Error Resume Next
Application.DisplayAlerts = False
With ThisWorkbook.VBProject.References
.Remove .Item("ProgressIndicator")
Debug.Print Err.Number
End With
Application.DisplayAlerts = True
On Error GoTo 0

Application.DisplayAlerts = False
ThisWorkbook.VBProject.References.AddFromFile
("c:\ProgressIndicator.dll")
Application.DisplayAlerts = True

So, in the first instance i delete the reference and then i
add it up again. Please note that in the current procedure
i do not use the dll, the dll is used from another procedure.

So, there are two cases one in which the dll is already
referenced and one in which it is not.

Suppose that it is referenced, then the code in deleteing
the reference comes up with "Can't enter break mode at this
time" and the options "continue" or "end only" are
possible. So i used debug.print err.number to get the error
number, which is zero!

If its not referenced then it goes smoothly through the
"deletion" routine (as there is nothing to delete) and
again comes up with "Can't enter break mode at this time"
"continue" or "end" options. Now, here the strangest thing
happens, i click on end and i have a look at the
references, and the code has added a reference to
"ProgressIndicator.dll" but not on "C:\" but rather on
"C:\windows\System32\". I really don't get and of course
the "ProgressIndicator.dll" does not reside on system32...

I am a bit perplexed, sorry for the big post,
Thanks a lot for your replies,
rgrds,
Alex





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Add Remove DLL reference in VB

I 've tried stepping throught the code or just letting it
run, the same thing happens in both cases...

-----Original Message-----
Are you stepping through (debugging) the code?

--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Alex" wrote in message
...
Further to my previous post on the 10th, i have a few
questions/results to post,

i find it impossible to remove any reference without an
error coming up. I used the following code:

On Error Resume Next
Application.DisplayAlerts = False
With ThisWorkbook.VBProject.References
.Remove .Item("ProgressIndicator")
Debug.Print Err.Number
End With
Application.DisplayAlerts = True
On Error GoTo 0

Application.DisplayAlerts = False
ThisWorkbook.VBProject.References.AddFromFile
("c:\ProgressIndicator.dll")
Application.DisplayAlerts = True

So, in the first instance i delete the reference and then i
add it up again. Please note that in the current procedure
i do not use the dll, the dll is used from another

procedure.

So, there are two cases one in which the dll is already
referenced and one in which it is not.

Suppose that it is referenced, then the code in deleteing
the reference comes up with "Can't enter break mode at this
time" and the options "continue" or "end only" are
possible. So i used debug.print err.number to get the error
number, which is zero!

If its not referenced then it goes smoothly through the
"deletion" routine (as there is nothing to delete) and
again comes up with "Can't enter break mode at this time"
"continue" or "end" options. Now, here the strangest thing
happens, i click on end and i have a look at the
references, and the code has added a reference to
"ProgressIndicator.dll" but not on "C:\" but rather on
"C:\windows\System32\". I really don't get and of course
the "ProgressIndicator.dll" does not reside on system32...

I am a bit perplexed, sorry for the big post,
Thanks a lot for your replies,
rgrds,
Alex





.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,236
Default Add Remove DLL reference in VB

Tried the code at my end. I get error number 9 if the Reference doesn't
exist - as expected.
I don't get anything about "Can't enter break mode".

Suspecting some sort of corruption.
Suggest you export the module, delete it, import it.
or run Rob Bovey's code cleaner:
http://www.appspro.com/Utilities/CodeCleaner.htm


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Alex" wrote in message
...
I 've tried stepping throught the code or just letting it
run, the same thing happens in both cases...

-----Original Message-----
Are you stepping through (debugging) the code?

--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Alex" wrote in message
...
Further to my previous post on the 10th, i have a few
questions/results to post,

i find it impossible to remove any reference without an
error coming up. I used the following code:

On Error Resume Next
Application.DisplayAlerts = False
With ThisWorkbook.VBProject.References
.Remove .Item("ProgressIndicator")
Debug.Print Err.Number
End With
Application.DisplayAlerts = True
On Error GoTo 0

Application.DisplayAlerts = False
ThisWorkbook.VBProject.References.AddFromFile
("c:\ProgressIndicator.dll")
Application.DisplayAlerts = True

So, in the first instance i delete the reference and then i
add it up again. Please note that in the current procedure
i do not use the dll, the dll is used from another

procedure.

So, there are two cases one in which the dll is already
referenced and one in which it is not.

Suppose that it is referenced, then the code in deleteing
the reference comes up with "Can't enter break mode at this
time" and the options "continue" or "end only" are
possible. So i used debug.print err.number to get the error
number, which is zero!

If its not referenced then it goes smoothly through the
"deletion" routine (as there is nothing to delete) and
again comes up with "Can't enter break mode at this time"
"continue" or "end" options. Now, here the strangest thing
happens, i click on end and i have a look at the
references, and the code has added a reference to
"ProgressIndicator.dll" but not on "C:\" but rather on
"C:\windows\System32\". I really don't get and of course
the "ProgressIndicator.dll" does not reside on system32...

I am a bit perplexed, sorry for the big post,
Thanks a lot for your replies,
rgrds,
Alex





.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Add Remove DLL reference in VB

Rob,

thanks for your help, but i doubt that the code is
corrupted, it is a very simple 20 line procedure that works
just fine if you dont programmatically add the reference,
the problem seems to be in adding the reference through
code, i had a look at

http://support.microsoft.com/default...b;en-us;155051

but that doesn's solve the problem.

The most amazing thing is that it keeps adding a reference
to c:\windows\system32 and i'm asking it to add it to c:\

it doens't make much sense,

anywayz, thanks for your help.
Alex
-----Original Message-----
Tried the code at my end. I get error number 9 if the

Reference doesn't
exist - as expected.
I don't get anything about "Can't enter break mode".

Suspecting some sort of corruption.
Suggest you export the module, delete it, import it.
or run Rob Bovey's code cleaner:
http://www.appspro.com/Utilities/CodeCleaner.htm


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Alex" wrote in message
...
I 've tried stepping throught the code or just letting it
run, the same thing happens in both cases...

-----Original Message-----
Are you stepping through (debugging) the code?

--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Alex" wrote in

message
...
Further to my previous post on the 10th, i have a few
questions/results to post,

i find it impossible to remove any reference without an
error coming up. I used the following code:

On Error Resume Next
Application.DisplayAlerts = False
With ThisWorkbook.VBProject.References
.Remove .Item("ProgressIndicator")
Debug.Print Err.Number
End With
Application.DisplayAlerts = True
On Error GoTo 0

Application.DisplayAlerts = False
ThisWorkbook.VBProject.References.AddFromFile
("c:\ProgressIndicator.dll")
Application.DisplayAlerts = True

So, in the first instance i delete the reference and

then i
add it up again. Please note that in the current

procedure
i do not use the dll, the dll is used from another

procedure.

So, there are two cases one in which the dll is already
referenced and one in which it is not.

Suppose that it is referenced, then the code in deleteing
the reference comes up with "Can't enter break mode

at this
time" and the options "continue" or "end only" are
possible. So i used debug.print err.number to get the

error
number, which is zero!

If its not referenced then it goes smoothly through the
"deletion" routine (as there is nothing to delete) and
again comes up with "Can't enter break mode at this time"
"continue" or "end" options. Now, here the strangest

thing
happens, i click on end and i have a look at the
references, and the code has added a reference to
"ProgressIndicator.dll" but not on "C:\" but rather on
"C:\windows\System32\". I really don't get and of course
the "ProgressIndicator.dll" does not reside on

system32...

I am a bit perplexed, sorry for the big post,
Thanks a lot for your replies,
rgrds,
Alex





.



.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Add Remove DLL reference in VB

Thinking about what you just said, you might be right in
that before i tried to programmatically add the reference i
added it manually so this may somehow confuse VBA.

How do i permanently delete a reference so that it would
not appear in the tools-references list at all.

By physically deleting the file the list still displays the
reference name, i.e. progressindicator, but when you click
on it it says error in loading dll, unfortunately it
doesn't prompt you to permanently delete ir

thanks,
Alex




-----Original Message-----
Tried the code at my end. I get error number 9 if the

Reference doesn't
exist - as expected.
I don't get anything about "Can't enter break mode".

Suspecting some sort of corruption.
Suggest you export the module, delete it, import it.
or run Rob Bovey's code cleaner:
http://www.appspro.com/Utilities/CodeCleaner.htm


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Alex" wrote in message
...
I 've tried stepping throught the code or just letting it
run, the same thing happens in both cases...

-----Original Message-----
Are you stepping through (debugging) the code?

--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Alex" wrote in

message
...
Further to my previous post on the 10th, i have a few
questions/results to post,

i find it impossible to remove any reference without an
error coming up. I used the following code:

On Error Resume Next
Application.DisplayAlerts = False
With ThisWorkbook.VBProject.References
.Remove .Item("ProgressIndicator")
Debug.Print Err.Number
End With
Application.DisplayAlerts = True
On Error GoTo 0

Application.DisplayAlerts = False
ThisWorkbook.VBProject.References.AddFromFile
("c:\ProgressIndicator.dll")
Application.DisplayAlerts = True

So, in the first instance i delete the reference and

then i
add it up again. Please note that in the current

procedure
i do not use the dll, the dll is used from another

procedure.

So, there are two cases one in which the dll is already
referenced and one in which it is not.

Suppose that it is referenced, then the code in deleteing
the reference comes up with "Can't enter break mode

at this
time" and the options "continue" or "end only" are
possible. So i used debug.print err.number to get the

error
number, which is zero!

If its not referenced then it goes smoothly through the
"deletion" routine (as there is nothing to delete) and
again comes up with "Can't enter break mode at this time"
"continue" or "end" options. Now, here the strangest

thing
happens, i click on end and i have a look at the
references, and the code has added a reference to
"ProgressIndicator.dll" but not on "C:\" but rather on
"C:\windows\System32\". I really don't get and of course
the "ProgressIndicator.dll" does not reside on

system32...

I am a bit perplexed, sorry for the big post,
Thanks a lot for your replies,
rgrds,
Alex





.



.

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,236
Default Add Remove DLL reference in VB

You know how to delete it via automation. The manual way is via Tools |
References.

I don't know of any other way.

--
Rob van Gelder - http://www.vangelder.co.nz/excel


"alex" wrote in message
...
Thinking about what you just said, you might be right in
that before i tried to programmatically add the reference i
added it manually so this may somehow confuse VBA.

How do i permanently delete a reference so that it would
not appear in the tools-references list at all.

By physically deleting the file the list still displays the
reference name, i.e. progressindicator, but when you click
on it it says error in loading dll, unfortunately it
doesn't prompt you to permanently delete ir

thanks,
Alex




-----Original Message-----
Tried the code at my end. I get error number 9 if the

Reference doesn't
exist - as expected.
I don't get anything about "Can't enter break mode".

Suspecting some sort of corruption.
Suggest you export the module, delete it, import it.
or run Rob Bovey's code cleaner:
http://www.appspro.com/Utilities/CodeCleaner.htm


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Alex" wrote in message
...
I 've tried stepping throught the code or just letting it
run, the same thing happens in both cases...

-----Original Message-----
Are you stepping through (debugging) the code?

--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Alex" wrote in

message
...
Further to my previous post on the 10th, i have a few
questions/results to post,

i find it impossible to remove any reference without an
error coming up. I used the following code:

On Error Resume Next
Application.DisplayAlerts = False
With ThisWorkbook.VBProject.References
.Remove .Item("ProgressIndicator")
Debug.Print Err.Number
End With
Application.DisplayAlerts = True
On Error GoTo 0

Application.DisplayAlerts = False
ThisWorkbook.VBProject.References.AddFromFile
("c:\ProgressIndicator.dll")
Application.DisplayAlerts = True

So, in the first instance i delete the reference and

then i
add it up again. Please note that in the current

procedure
i do not use the dll, the dll is used from another
procedure.

So, there are two cases one in which the dll is already
referenced and one in which it is not.

Suppose that it is referenced, then the code in deleteing
the reference comes up with "Can't enter break mode

at this
time" and the options "continue" or "end only" are
possible. So i used debug.print err.number to get the

error
number, which is zero!

If its not referenced then it goes smoothly through the
"deletion" routine (as there is nothing to delete) and
again comes up with "Can't enter break mode at this time"
"continue" or "end" options. Now, here the strangest

thing
happens, i click on end and i have a look at the
references, and the code has added a reference to
"ProgressIndicator.dll" but not on "C:\" but rather on
"C:\windows\System32\". I really don't get and of course
the "ProgressIndicator.dll" does not reside on

system32...

I am a bit perplexed, sorry for the big post,
Thanks a lot for your replies,
rgrds,
Alex





.



.



  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Add Remove DLL reference in VB

I want to delete it of the list so it does not appear there
at all!
-----Original Message-----
You know how to delete it via automation. The manual way

is via Tools |
References.

I don't know of any other way.

--
Rob van Gelder - http://www.vangelder.co.nz/excel


"alex" wrote in message
...
Thinking about what you just said, you might be right in
that before i tried to programmatically add the reference i
added it manually so this may somehow confuse VBA.

How do i permanently delete a reference so that it would
not appear in the tools-references list at all.

By physically deleting the file the list still displays the
reference name, i.e. progressindicator, but when you click
on it it says error in loading dll, unfortunately it
doesn't prompt you to permanently delete ir

thanks,
Alex




-----Original Message-----
Tried the code at my end. I get error number 9 if the

Reference doesn't
exist - as expected.
I don't get anything about "Can't enter break mode".

Suspecting some sort of corruption.
Suggest you export the module, delete it, import it.
or run Rob Bovey's code cleaner:
http://www.appspro.com/Utilities/CodeCleaner.htm


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Alex" wrote in

message
...
I 've tried stepping throught the code or just letting it
run, the same thing happens in both cases...

-----Original Message-----
Are you stepping through (debugging) the code?

--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Alex" wrote in

message
...
Further to my previous post on the 10th, i have a few
questions/results to post,

i find it impossible to remove any reference

without an
error coming up. I used the following code:

On Error Resume Next
Application.DisplayAlerts = False
With ThisWorkbook.VBProject.References
.Remove .Item("ProgressIndicator")
Debug.Print Err.Number
End With
Application.DisplayAlerts = True
On Error GoTo 0

Application.DisplayAlerts = False
ThisWorkbook.VBProject.References.AddFromFile
("c:\ProgressIndicator.dll")
Application.DisplayAlerts = True

So, in the first instance i delete the reference and

then i
add it up again. Please note that in the current

procedure
i do not use the dll, the dll is used from another
procedure.

So, there are two cases one in which the dll is

already
referenced and one in which it is not.

Suppose that it is referenced, then the code in

deleteing
the reference comes up with "Can't enter break mode

at this
time" and the options "continue" or "end only" are
possible. So i used debug.print err.number to get the

error
number, which is zero!

If its not referenced then it goes smoothly

through the
"deletion" routine (as there is nothing to delete) and
again comes up with "Can't enter break mode at

this time"
"continue" or "end" options. Now, here the strangest

thing
happens, i click on end and i have a look at the
references, and the code has added a reference to
"ProgressIndicator.dll" but not on "C:\" but rather on
"C:\windows\System32\". I really don't get and of

course
the "ProgressIndicator.dll" does not reside on

system32...

I am a bit perplexed, sorry for the big post,
Thanks a lot for your replies,
rgrds,
Alex





.



.



.

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default Add Remove DLL reference in VB

you probably cant do it from within the compiled project itself
i suggest you to put your 'changing' code in another project, and call the
function via an ontime


keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"Alex" wrote:

Further to my previous post on the 10th, i have a few
questions/results to post,

i find it impossible to remove any reference without an
error coming up. I used the following code:

On Error Resume Next
Application.DisplayAlerts = False
With ThisWorkbook.VBProject.References
.Remove .Item("ProgressIndicator")
Debug.Print Err.Number
End With
Application.DisplayAlerts = True
On Error GoTo 0


I am a bit perplexed, sorry for the big post,
Thanks a lot for your replies,
rgrds,
Alex





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
How do I remove a reference from a cell? stayathome working girl Excel Discussion (Misc queries) 1 April 18th 06 08:52 PM
How to remove path from macro reference seppo Excel Discussion (Misc queries) 2 February 22nd 06 07:08 AM
remove rows with the same reference JT[_2_] Excel Programming 1 April 30th 04 03:48 PM
remove reference via code Brian Excel Programming 1 April 22nd 04 06:10 PM
Remove a reference Niklas[_3_] Excel Programming 8 November 11th 03 10:19 AM


All times are GMT +1. The time now is 11:01 AM.

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

About Us

"It's about Microsoft Excel"