View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Guenter-Josef Guenter-Josef is offline
external usenet poster
 
Posts: 1
Default Adding library references programmatically


Hi Allen,

i have a proposal how you can dynamically add library references.
You open an empty EXCEL-file with an OLE-Connection, add a new modul
and import a small macro which looks like this:
Sub Set_Reference
Dim c As Object
Set c = Application.VBE.ActiveVBProject.References.AddFrom Guid(..)
End Sub

You save this EXCEL file, open the file again and start the macro wit
the appropriate method like (the coding depends on the language whic
which you build up the OLE-connection)

call method of H_WORKS 'SaveAs' Exporting #1 = filename
CALL METHOD OF H_WORKS 'Close'
CALL METHOD OF H_WORKS 'Open' = H_WORK EXPORTING
#1 = filename
CALL METHOD OF EXCEL1 'Run' EXPORTING #1 =
'Set_Reference'.

After this the new reference is set and you can add the macros whic
you want to execute the same way as described above. After this sav
the file, reopen it and start the macro you want.

I don't know if this is what you want, but i desperatly looking fo
this during the last weeks and was happy when i finally found it by m
own.

Take care
Guente

--
Guenter-Jose
-----------------------------------------------------------------------
Guenter-Josef's Profile: http://www.excelforum.com/member.php...fo&userid=2633
View this thread: http://www.excelforum.com/showthread.php?threadid=27370