473,320 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Dynamic .dll reference

Hello, I have an application that uses word automation and everything is
working perfectly. However, I have one potential issue

1) I am using Office XP on my machine to design the app, however I
realize that not everyone will have that version of Office and thus won't
have the version 10 interop .dll. Is there any way to iterate through the
available assemblies on the system and dynamically reference them (instead
of explicitly adding a reference in the designer)?

I want to make sure that if someone is using Office 2000 it will reference
version 9 and office 2003 will be 11.

Thanks for the help!!


Nov 20 '05 #1
1 1603
On 2004-02-19, Brian Mitchell <Ma********@hotmail.com> wrote:
Hello, I have an application that uses word automation and everything is
working perfectly. However, I have one potential issue

1) I am using Office XP on my machine to design the app, however I
realize that not everyone will have that version of Office and thus won't
have the version 10 interop .dll. Is there any way to iterate through the
available assemblies on the system and dynamically reference them (instead
of explicitly adding a reference in the designer)?

I want to make sure that if someone is using Office 2000 it will reference
version 9 and office 2003 will be 11.

Thanks for the help!!


I'm going through that myself right now... The best, I have found so
far is to use late binding (that means Option Strict Off for the modules
where you're doing the interop)..

Option Strict Off
Option Explicit On

....

Public oExcel As Object = CreateObject("Excel.Application")

oExcel.Visible = True
The disadvantage of doing this is that you loose intellisense, and of
course late binding is slower - but the advantage is that you're not
tied to a specific version of office :)

I admit to not being an expert at Office development, but what I have
done in the past for the couple of apps I worked on in VB6 is to just go
ahead and reference the library on my system and develope the code.
When I'm done, I then remove the reference and convert all the types
object references to Object. Of course, you need to make sure you don't
use any version specific features, so you may want to do this against
the earliest version of Office you expect to support.

Other then that... Well, I have been trying to see if there is a way to
get a reference to the current office type library and generate a
interop assembly using the TypeLibaryConverter class... But, so far I
haven't come up with anything useful.

Well there's my two cents... Hopefully someone will have some better
ideas, so that we can both benifit here :) By the way, be glad your
doing the late binding code in VB.NET and not C#... It is a whole lot
harder...

// off the top of my head - so it may not be 100% accurate :)
public Type excelType = Type.GetTypeFromProgId("Excel.Application");
public object excelObject = Activator.CreateInstance(excelType);

excelType.InvokeMember(
"Visible",
BindingFlags.SetProperty,
null,
excelObject,
new object[] {true});

Yikes!
--
Tom Shelton [MVP]
Powered By Gentoo Linux 1.4
Once the toothpaste is out of the tube, it's hard to get it back in.
-- H.R. Haldeman
Nov 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Eyeawanda Pondicherry | last post by:
I have put some code together that creates an enum dynamically from some database values. The enum can be read perfectly by an application that references the dynamically generated dll. If I...
8
by: George Meng | last post by:
I got a tough question: The backgroud for this question is: I want to design an application works like a engine. After release, we can still customize a form by adding a button, and source code...
7
by: Mike Livenspargar | last post by:
We have an application converted from v1.1 Framework to v2.0. The executable references a class library which in turn has a web reference. The web reference 'URL Behavior' is set to dynamic. We...
2
by: HockeyFan | last post by:
I have a web service that has been working, but I recently changed it so that the reference would be dynamic. Locally, within Visual Studio, it works fine. However, once deployed, the dll I use...
7
by: Jo | last post by:
Hi, How can i differentiate between static and dynamic allocated objects? For example: void SomeFunction1() { CObject *objectp = new CObject; CObject object;
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.