ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Change Location of VBE References with VBA (https://www.excelbanter.com/excel-programming/394014-re-change-location-vbe-references-vba.html)

Peter T

Change Location of VBE References with VBA
 
I think my Idea of a reference is wrong?

Is that a question?

Difficult to understand what you are doing and why you want to change file
location of the dll. However if that's what you are doing, and the dll is an
ActiveX, you will need to re-register the dll. Having done that, providing
the dll is the same version or later as that to which a reference was set in
your project, you shouldn't need to remove and re-add the reference to your
project.

Regards,
Peter T

"vqthomf" wrote in message
...
I think my Idea of a reference is wrong?
I am trying to change the location of this file Y:\Quality\GALC system\HTR
support\Turkey\Data Files\msadox.dll to another location can this be done

as
nothing I have tried works.
TIA
Charles

"Peter T" wrote:

Hi Charles,

Without seeing your code its not possible to know if it fails because

the
code is wrong or fails for some other reason, eg the reference doesn't
exist. Try something like this -

Dim rf As Reference

'With ThisWorkbook.VBProject.References
With Application.VBE.ActiveVBProject.References
On Error Resume Next
Set rf = .Item("ref name to be removed")
If Not rf Is Nothing Then
.Remove rf
Else
' ref doesn't exist
End If
End With

Regards,
Peter T

"vqthomf" wrote in message
...
Hi all I was wondering if Reference location be changed using vba code

I
have
tried using Application.VBE.ActiveVBProject.References.AddFrom File but

I
need
to remove the reference before adding a new one when I try to remove

the
it I
get an error has one done this before if so can you please help?.
TIA
Charles







vqthomf

Change Location of VBE References with VBA
 
we are supporting a sister company in Turkey and the report programmes that
we build and test here work fine but when we send it you them it wont work
due to references!, I wanted to have the programme know where it is and
change the location.
TIA
Charles

"Peter T" wrote:

I think my Idea of a reference is wrong?


Is that a question?

Difficult to understand what you are doing and why you want to change file
location of the dll. However if that's what you are doing, and the dll is an
ActiveX, you will need to re-register the dll. Having done that, providing
the dll is the same version or later as that to which a reference was set in
your project, you shouldn't need to remove and re-add the reference to your
project.

Regards,
Peter T

"vqthomf" wrote in message
...
I think my Idea of a reference is wrong?
I am trying to change the location of this file Y:\Quality\GALC system\HTR
support\Turkey\Data Files\msadox.dll to another location can this be done

as
nothing I have tried works.
TIA
Charles

"Peter T" wrote:

Hi Charles,

Without seeing your code its not possible to know if it fails because

the
code is wrong or fails for some other reason, eg the reference doesn't
exist. Try something like this -

Dim rf As Reference

'With ThisWorkbook.VBProject.References
With Application.VBE.ActiveVBProject.References
On Error Resume Next
Set rf = .Item("ref name to be removed")
If Not rf Is Nothing Then
.Remove rf
Else
' ref doesn't exist
End If
End With

Regards,
Peter T

"vqthomf" wrote in message
...
Hi all I was wondering if Reference location be changed using vba code

I
have
tried using Application.VBE.ActiveVBProject.References.AddFrom File but

I
need
to remove the reference before adding a new one when I try to remove

the
it I
get an error has one done this before if so can you please help?.
TIA
Charles







Peter T

Change Location of VBE References with VBA
 
I wanted to have the programme know where it is and
change the location.


I don't think the location of the dll is not the issue, is it actually
registered on the target machine.

If it is registered it might be an older version (along the lines I
mentioned previously), have you checked. If so removing (as per example
posted previously) and re-adding the reference might work.

Regards,
Peter T

"vqthomf" wrote in message
...
we are supporting a sister company in Turkey and the report programmes

that
we build and test here work fine but when we send it you them it wont work
due to references!, I wanted to have the programme know where it is and
change the location.
TIA
Charles

"Peter T" wrote:

I think my Idea of a reference is wrong?


Is that a question?

Difficult to understand what you are doing and why you want to change

file
location of the dll. However if that's what you are doing, and the dll

is an
ActiveX, you will need to re-register the dll. Having done that,

providing
the dll is the same version or later as that to which a reference was

set in
your project, you shouldn't need to remove and re-add the reference to

your
project.

Regards,
Peter T

"vqthomf" wrote in message
...
I think my Idea of a reference is wrong?
I am trying to change the location of this file Y:\Quality\GALC

system\HTR
support\Turkey\Data Files\msadox.dll to another location can this be

done
as
nothing I have tried works.
TIA
Charles

"Peter T" wrote:

Hi Charles,

Without seeing your code its not possible to know if it fails

because
the
code is wrong or fails for some other reason, eg the reference

doesn't
exist. Try something like this -

Dim rf As Reference

'With ThisWorkbook.VBProject.References
With Application.VBE.ActiveVBProject.References
On Error Resume Next
Set rf = .Item("ref name to be removed")
If Not rf Is Nothing Then
.Remove rf
Else
' ref doesn't exist
End If
End With

Regards,
Peter T

"vqthomf" wrote in message
...
Hi all I was wondering if Reference location be changed using vba

code
I
have
tried using Application.VBE.ActiveVBProject.References.AddFrom File

but
I
need
to remove the reference before adding a new one when I try to

remove
the
it I
get an error has one done this before if so can you please help?.
TIA
Charles









vqthomf

Change Location of VBE References with VBA
 
I tried the code you gaive me but I still get an error, their location is in
Trukish and that why it can't fine the dll's and when there is a problem or
they want an upgrade they send it back and we have to manaualy change it.

"Peter T" wrote:

I wanted to have the programme know where it is and
change the location.


I don't think the location of the dll is not the issue, is it actually
registered on the target machine.

If it is registered it might be an older version (along the lines I
mentioned previously), have you checked. If so removing (as per example
posted previously) and re-adding the reference might work.

Regards,
Peter T

"vqthomf" wrote in message
...
we are supporting a sister company in Turkey and the report programmes

that
we build and test here work fine but when we send it you them it wont work
due to references!, I wanted to have the programme know where it is and
change the location.
TIA
Charles

"Peter T" wrote:

I think my Idea of a reference is wrong?

Is that a question?

Difficult to understand what you are doing and why you want to change

file
location of the dll. However if that's what you are doing, and the dll

is an
ActiveX, you will need to re-register the dll. Having done that,

providing
the dll is the same version or later as that to which a reference was

set in
your project, you shouldn't need to remove and re-add the reference to

your
project.

Regards,
Peter T

"vqthomf" wrote in message
...
I think my Idea of a reference is wrong?
I am trying to change the location of this file Y:\Quality\GALC

system\HTR
support\Turkey\Data Files\msadox.dll to another location can this be

done
as
nothing I have tried works.
TIA
Charles

"Peter T" wrote:

Hi Charles,

Without seeing your code its not possible to know if it fails

because
the
code is wrong or fails for some other reason, eg the reference

doesn't
exist. Try something like this -

Dim rf As Reference

'With ThisWorkbook.VBProject.References
With Application.VBE.ActiveVBProject.References
On Error Resume Next
Set rf = .Item("ref name to be removed")
If Not rf Is Nothing Then
.Remove rf
Else
' ref doesn't exist
End If
End With

Regards,
Peter T

"vqthomf" wrote in message
...
Hi all I was wondering if Reference location be changed using vba

code
I
have
tried using Application.VBE.ActiveVBProject.References.AddFrom File

but
I
need
to remove the reference before adding a new one when I try to

remove
the
it I
get an error has one done this before if so can you please help?.
TIA
Charles










Peter T

Change Location of VBE References with VBA
 
Did you digest this part of my previous post -

I don't think the location of the dll is not the issue, is it actually
registered on the target machine.


What's the answer to this question.

Regards,
Peter T

"vqthomf" wrote in message
...
I tried the code you gaive me but I still get an error, their location is

in
Trukish and that why it can't fine the dll's and when there is a problem

or
they want an upgrade they send it back and we have to manaualy change it.

"Peter T" wrote:

I wanted to have the programme know where it is and
change the location.


I don't think the location of the dll is not the issue, is it actually
registered on the target machine.

If it is registered it might be an older version (along the lines I
mentioned previously), have you checked. If so removing (as per example
posted previously) and re-adding the reference might work.

Regards,
Peter T

"vqthomf" wrote in message
...
we are supporting a sister company in Turkey and the report programmes

that
we build and test here work fine but when we send it you them it wont

work
due to references!, I wanted to have the programme know where it is

and
change the location.
TIA
Charles

"Peter T" wrote:

I think my Idea of a reference is wrong?

Is that a question?

Difficult to understand what you are doing and why you want to

change
file
location of the dll. However if that's what you are doing, and the

dll
is an
ActiveX, you will need to re-register the dll. Having done that,

providing
the dll is the same version or later as that to which a reference

was
set in
your project, you shouldn't need to remove and re-add the reference

to
your
project.

Regards,
Peter T

"vqthomf" wrote in message
...
I think my Idea of a reference is wrong?
I am trying to change the location of this file Y:\Quality\GALC

system\HTR
support\Turkey\Data Files\msadox.dll to another location can this

be
done
as
nothing I have tried works.
TIA
Charles

"Peter T" wrote:

Hi Charles,

Without seeing your code its not possible to know if it fails

because
the
code is wrong or fails for some other reason, eg the reference

doesn't
exist. Try something like this -

Dim rf As Reference

'With ThisWorkbook.VBProject.References
With Application.VBE.ActiveVBProject.References
On Error Resume Next
Set rf = .Item("ref name to be removed")
If Not rf Is Nothing Then
.Remove rf
Else
' ref doesn't exist
End If
End With

Regards,
Peter T

"vqthomf" wrote in message
...
Hi all I was wondering if Reference location be changed using

vba
code
I
have
tried using

Application.VBE.ActiveVBProject.References.AddFrom File
but
I
need
to remove the reference before adding a new one when I try to

remove
the
it I
get an error has one done this before if so can you please

help?.
TIA
Charles













All times are GMT +1. The time now is 02:53 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com