1

Using Visual Basic 2008 Express Edition

2 PCs are involved:

PC1 has VBEE and Excel 2007 installed
PC2 (target machine) does not have VBEE installed, and has Excel 2000

What I am trying to accomplish is to build an app on PC1 to use on PC2.

Of course, when I reference the 12.0 library during the build and then try to run using 9.0 on the target machine, I get a "can't find 12.0 object library" message. Also, I can't use late binding (as shown below): PC2's security settings apparently prohibit this...

    Dim objExcel As Object 'Excel.Application
    Dim objWB As Object 'Excel.Workbook
    Dim objWS As Object 'Excel.Worksheet
    Dim objRng As Object 'Excel.Range

    Try
        'Try to Open Excel, Add a workbook and worksheet
        objExcel = CreateObject("Excel.Application") 'New Excel.Application

    etc...

So, is there any way to add reference to Excel 9.0 without it actually being installed on the same machine as VBEE?

Is there any other way around this?

pnuts
  • 58,317
  • 11
  • 87
  • 139
MSD
  • 48
  • 5
  • You appear to be using late binding, so why do you need the library? (http://www.vbforums.com/showthread.php?t=455162) – Fionnuala Sep 06 '10 at 20:55
  • Hi Remou. I tried, but can't :-( "Also, I can't use late binding (as shown below): PC2's security settings apparently prohibit this..." – MSD Sep 06 '10 at 21:09
  • I know very little about this, but AFAIK there are only two choices, either use the earliest library of use late binding. Have you set Option Strict On, because apparently that stops you using late binding? What error do you get with the 2nd PC? If nothing else, these questions may be of use to others who wish to help. – Fionnuala Sep 06 '10 at 22:40

1 Answers1

0

Sure, I do that all the time. You'll need to grab the TLBs (or the main EXE or DLL that you have to reference) from the machine with the older version, copy IT to your dev machine (preferably somewhere in your project so you can put it under VCS, cause it just because part of the source of your project, and then set your references to that dll.

I've successfully done this with Word, Excel, PPT, and Outlook, coding against an addin that had to run in everything from Office 2000 through 2010.

I grabbed all the relevant TLBs and DLLs that contained the TLBs from various machines, located them centrally, and referenced those copies.

With .NET, you can even simultaneously reference several WORD tlbs (though I didn't have any need to actually do it). With VB6, you can't really take it that far, but again, you generally shouldn't need to.

DarinH
  • 4,868
  • 2
  • 22
  • 32