Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Reference to dll object in VBA

I've written a VB6 app that is a dll (FinV4.dll) for an Excel application.
When I re-make the dll and then open Excel, the reference always comes back
as "MISSING: DLL for FinV4".

I can uncheck the reference, exit references dialog, re-enter References,
find the new reference, check it, exit References and all runs well.

Since this application will be used predominantly by others, what I would
like to do is delete the missing reference and connect to the proper
reference programatically. It will facilitate future updates to both the
workbook and the dll when sent to others.

What I've done so far is:

Public Sub ConnectToFinPlannerDLL()

with ThisWorkbook.VBProject.References
.Remove "C:\Program Files\FinV4.dll"
.AddFromFile "C:\Program Files\FinV4.dll"
end with

End Sub

The remove statement doesn't remove the reference although if I manually
remove the Missing reference and just run the .AddFromFile line it connects
to the new dll. I've tried different forms of the Remove statement but have
been unable to make it work.

I've also removed early binding to prevent errors on workbook startup for
the global variables used to connect to the classes in the dll.

Any help will be appreciated.

End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Reference to dll object in VBA

Best approach is avoid the problem altogether.

With Compatibility set to none or Project, compile a dll in say
c:\myProject\Compat\
(could do that with your existing project)

For all future dlls compile with Compatibility set to Binary and into a
different folder, eg
c:\myproject\dll\

This way, providing you do not "break" compatibility you should be able to
distribute updated dll's to your users without the need to change any
references.
You'll get a warning if you are about to break compatibility when you
compile, eg you remove something public or change it's 'type' (even an
argument in a routine in a public interface). However no problem to add new
public stuff or do whatever to anything that's not publicly exposed.

For the Compatibility options look in project properties / Component. With
the Binary option, browse to the dll in the 'compat' folder.

For now, probably best distribute an updated xls (with the dll reference
included) together with the new binary compatibility dll. In future just the
updated dll should be OK.
If you need to "break" compatibility you'll need to think about the
reference again, try and avoid.

Regards,
Peter T


"JohnS-BelmontNC" wrote in
message ...
I've written a VB6 app that is a dll (FinV4.dll) for an Excel application.
When I re-make the dll and then open Excel, the reference always comes
back
as "MISSING: DLL for FinV4".

I can uncheck the reference, exit references dialog, re-enter References,
find the new reference, check it, exit References and all runs well.

Since this application will be used predominantly by others, what I would
like to do is delete the missing reference and connect to the proper
reference programatically. It will facilitate future updates to both the
workbook and the dll when sent to others.

What I've done so far is:

Public Sub ConnectToFinPlannerDLL()

with ThisWorkbook.VBProject.References
.Remove "C:\Program Files\FinV4.dll"
.AddFromFile "C:\Program Files\FinV4.dll"
end with

End Sub

The remove statement doesn't remove the reference although if I manually
remove the Missing reference and just run the .AddFromFile line it
connects
to the new dll. I've tried different forms of the Remove statement but
have
been unable to make it work.

I've also removed early binding to prevent errors on workbook startup for
the global variables used to connect to the classes in the dll.

Any help will be appreciated.

End Sub



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Reference to dll object in VBA

Peter, Thanks.

Do you have a reference article I might read to better understand what
you've describe below.

"Peter T" wrote:

Best approach is avoid the problem altogether.

With Compatibility set to none or Project, compile a dll in say
c:\myProject\Compat\
(could do that with your existing project)

For all future dlls compile with Compatibility set to Binary and into a
different folder, eg
c:\myproject\dll\

This way, providing you do not "break" compatibility you should be able to
distribute updated dll's to your users without the need to change any
references.
You'll get a warning if you are about to break compatibility when you
compile, eg you remove something public or change it's 'type' (even an
argument in a routine in a public interface). However no problem to add new
public stuff or do whatever to anything that's not publicly exposed.

For the Compatibility options look in project properties / Component. With
the Binary option, browse to the dll in the 'compat' folder.

For now, probably best distribute an updated xls (with the dll reference
included) together with the new binary compatibility dll. In future just the
updated dll should be OK.
If you need to "break" compatibility you'll need to think about the
reference again, try and avoid.

Regards,
Peter T


"JohnS-BelmontNC" wrote in
message ...
I've written a VB6 app that is a dll (FinV4.dll) for an Excel application.
When I re-make the dll and then open Excel, the reference always comes
back
as "MISSING: DLL for FinV4".

I can uncheck the reference, exit references dialog, re-enter References,
find the new reference, check it, exit References and all runs well.

Since this application will be used predominantly by others, what I would
like to do is delete the missing reference and connect to the proper
reference programatically. It will facilitate future updates to both the
workbook and the dll when sent to others.

What I've done so far is:

Public Sub ConnectToFinPlannerDLL()

with ThisWorkbook.VBProject.References
.Remove "C:\Program Files\FinV4.dll"
.AddFromFile "C:\Program Files\FinV4.dll"
end with

End Sub

The remove statement doesn't remove the reference although if I manually
remove the Missing reference and just run the .AddFromFile line it
connects
to the new dll. I've tried different forms of the Remove statement but
have
been unable to make it work.

I've also removed early binding to prevent errors on workbook startup for
the global variables used to connect to the classes in the dll.

Any help will be appreciated.

End Sub




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Reference to dll object in VBA

http://www.vbsight.com/BinaryComp.htm

Regards,
Peter T

"JohnS-BelmontNC" wrote in
message ...
Peter, Thanks.

Do you have a reference article I might read to better understand what
you've describe below.

"Peter T" wrote:

Best approach is avoid the problem altogether.

With Compatibility set to none or Project, compile a dll in say
c:\myProject\Compat\
(could do that with your existing project)

For all future dlls compile with Compatibility set to Binary and into a
different folder, eg
c:\myproject\dll\

This way, providing you do not "break" compatibility you should be able
to
distribute updated dll's to your users without the need to change any
references.
You'll get a warning if you are about to break compatibility when you
compile, eg you remove something public or change it's 'type' (even an
argument in a routine in a public interface). However no problem to add
new
public stuff or do whatever to anything that's not publicly exposed.

For the Compatibility options look in project properties / Component.
With
the Binary option, browse to the dll in the 'compat' folder.

For now, probably best distribute an updated xls (with the dll reference
included) together with the new binary compatibility dll. In future just
the
updated dll should be OK.
If you need to "break" compatibility you'll need to think about the
reference again, try and avoid.

Regards,
Peter T


"JohnS-BelmontNC" wrote in
message ...
I've written a VB6 app that is a dll (FinV4.dll) for an Excel
application.
When I re-make the dll and then open Excel, the reference always comes
back
as "MISSING: DLL for FinV4".

I can uncheck the reference, exit references dialog, re-enter
References,
find the new reference, check it, exit References and all runs well.

Since this application will be used predominantly by others, what I
would
like to do is delete the missing reference and connect to the proper
reference programatically. It will facilitate future updates to both
the
workbook and the dll when sent to others.

What I've done so far is:

Public Sub ConnectToFinPlannerDLL()

with ThisWorkbook.VBProject.References
.Remove "C:\Program Files\FinV4.dll"
.AddFromFile "C:\Program Files\FinV4.dll"
end with

End Sub

The remove statement doesn't remove the reference although if I
manually
remove the Missing reference and just run the .AddFromFile line it
connects
to the new dll. I've tried different forms of the Remove statement but
have
been unable to make it work.

I've also removed early binding to prevent errors on workbook startup
for
the global variables used to connect to the classes in the dll.

Any help will be appreciated.

End Sub






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Reference to dll object in VBA

Thanks. I'll read the article and implement the changes. This way the
workbooks will always be backward compatible for this major version of the
dll.

"Peter T" wrote:

http://www.vbsight.com/BinaryComp.htm

Regards,
Peter T

"JohnS-BelmontNC" wrote in
message ...
Peter, Thanks.

Do you have a reference article I might read to better understand what
you've describe below.

"Peter T" wrote:

Best approach is avoid the problem altogether.

With Compatibility set to none or Project, compile a dll in say
c:\myProject\Compat\
(could do that with your existing project)

For all future dlls compile with Compatibility set to Binary and into a
different folder, eg
c:\myproject\dll\

This way, providing you do not "break" compatibility you should be able
to
distribute updated dll's to your users without the need to change any
references.
You'll get a warning if you are about to break compatibility when you
compile, eg you remove something public or change it's 'type' (even an
argument in a routine in a public interface). However no problem to add
new
public stuff or do whatever to anything that's not publicly exposed.

For the Compatibility options look in project properties / Component.
With
the Binary option, browse to the dll in the 'compat' folder.

For now, probably best distribute an updated xls (with the dll reference
included) together with the new binary compatibility dll. In future just
the
updated dll should be OK.
If you need to "break" compatibility you'll need to think about the
reference again, try and avoid.

Regards,
Peter T


"JohnS-BelmontNC" wrote in
message ...
I've written a VB6 app that is a dll (FinV4.dll) for an Excel
application.
When I re-make the dll and then open Excel, the reference always comes
back
as "MISSING: DLL for FinV4".

I can uncheck the reference, exit references dialog, re-enter
References,
find the new reference, check it, exit References and all runs well.

Since this application will be used predominantly by others, what I
would
like to do is delete the missing reference and connect to the proper
reference programatically. It will facilitate future updates to both
the
workbook and the dll when sent to others.

What I've done so far is:

Public Sub ConnectToFinPlannerDLL()

with ThisWorkbook.VBProject.References
.Remove "C:\Program Files\FinV4.dll"
.AddFromFile "C:\Program Files\FinV4.dll"
end with

End Sub

The remove statement doesn't remove the reference although if I
manually
remove the Missing reference and just run the .AddFromFile line it
connects
to the new dll. I've tried different forms of the Remove statement but
have
been unable to make it work.

I've also removed early binding to prevent errors on workbook startup
for
the global variables used to connect to the classes in the dll.

Any help will be appreciated.

End Sub






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
Check an object reference XP Excel Programming 2 October 19th 07 10:57 PM
why do I get this [object reference not set to an instance of an. experience4me Excel Discussion (Misc queries) 1 March 29th 07 04:40 PM
Using a string to set an object reference? Jeremy Excel Programming 2 January 3rd 07 02:02 PM
object reference not released when using ADO.NET pshen Excel Programming 0 October 27th 05 08:18 PM
web page object reference Thierry[_3_] Excel Programming 1 August 19th 04 08:35 AM


All times are GMT +1. The time now is 04:40 PM.

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

About Us

"It's about Microsoft Excel"