Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 109
Default dll files in Excel VBA or ADO

Can you "#include" a dll file in an Excel routine using VBA or ADO? I am
trying to make a routine that a user can copy and paste, without any other
efforts. Right now they have to select two references for the routine to
work. I can not find the equivalent of #include for VBA/ADO. Thank you.

Brent
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default dll files in Excel VBA or ADO


'Early binding
Dim oRS as New ADODB.Recordset '(the lazy way using New)


vs

'late binding - does not require VBA Project reference to ADO library
Dim oRS as Object
set oRS = CreateObject("ADODB.Recordset")

--
Tim Williams
Palo Alto, CA


"Brent" wrote in message ...
Can you "#include" a dll file in an Excel routine using VBA or ADO? I am
trying to make a routine that a user can copy and paste, without any other
efforts. Right now they have to select two references for the routine to
work. I can not find the equivalent of #include for VBA/ADO. Thank you.

Brent



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 109
Default dll files in Excel VBA or ADO

Okay I already have it as the lazy way, but I still have to go to
Tools-References and pick A.D.O. 2.8 library. Is there a way that I don't
have to go to Tools-References and do this for each new workbook?

Brent


"Tim Williams" wrote:


'Early binding
Dim oRS as New ADODB.Recordset '(the lazy way using New)


vs

'late binding - does not require VBA Project reference to ADO library
Dim oRS as Object
set oRS = CreateObject("ADODB.Recordset")

--
Tim Williams
Palo Alto, CA


"Brent" wrote in message ...
Can you "#include" a dll file in an Excel routine using VBA or ADO? I am
trying to make a routine that a user can copy and paste, without any other
efforts. Right now they have to select two references for the routine to
work. I can not find the equivalent of #include for VBA/ADO. Thank you.

Brent




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default dll files in Excel VBA or ADO

You want to use Late Binding as demonstrrated by Tim. Early binding binds the
dll at design time where as Late Binding binds the dll at run time. So use...

'late binding - does not require VBA Project reference to ADO library
Dim oRS as Object
set oRS = CreateObject("ADODB.Recordset")
--
HTH...

Jim Thomlinson


"Brent" wrote:

Okay I already have it as the lazy way, but I still have to go to
Tools-References and pick A.D.O. 2.8 library. Is there a way that I don't
have to go to Tools-References and do this for each new workbook?

Brent


"Tim Williams" wrote:


'Early binding
Dim oRS as New ADODB.Recordset '(the lazy way using New)


vs

'late binding - does not require VBA Project reference to ADO library
Dim oRS as Object
set oRS = CreateObject("ADODB.Recordset")

--
Tim Williams
Palo Alto, CA


"Brent" wrote in message ...
Can you "#include" a dll file in an Excel routine using VBA or ADO? I am
trying to make a routine that a user can copy and paste, without any other
efforts. Right now they have to select two references for the routine to
work. I can not find the equivalent of #include for VBA/ADO. Thank you.

Brent




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 109
Default dll files in Excel VBA or ADO

I am still having to select the library, otherwise the VBA project will not
run and stops at:

rs.Open "table1", cn, adOpenKeyset, adLockOptimistic, adCmdTable


"Jim Thomlinson" wrote:

You want to use Late Binding as demonstrrated by Tim. Early binding binds the
dll at design time where as Late Binding binds the dll at run time. So use...

'late binding - does not require VBA Project reference to ADO library
Dim oRS as Object
set oRS = CreateObject("ADODB.Recordset")
--
HTH...

Jim Thomlinson


"Brent" wrote:

Okay I already have it as the lazy way, but I still have to go to
Tools-References and pick A.D.O. 2.8 library. Is there a way that I don't
have to go to Tools-References and do this for each new workbook?

Brent


"Tim Williams" wrote:


'Early binding
Dim oRS as New ADODB.Recordset '(the lazy way using New)


vs

'late binding - does not require VBA Project reference to ADO library
Dim oRS as Object
set oRS = CreateObject("ADODB.Recordset")

--
Tim Williams
Palo Alto, CA


"Brent" wrote in message ...
Can you "#include" a dll file in an Excel routine using VBA or ADO? I am
trying to make a routine that a user can copy and paste, without any other
efforts. Right now they have to select two references for the routine to
work. I can not find the equivalent of #include for VBA/ADO. Thank you.

Brent





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default dll files in Excel VBA or ADO

You'll need to replace those named constans with their actual values. Look them up in the ObjectBrowser (with a reference to ADO
added temporarily)

Eg:
adOpenKeyset = 1
adLockOptimistic = 3
adCmdTable = 2



rs.Open "table1", cn, 1, 3, 2


--
Tim Williams
Palo Alto, CA


"Brent" wrote in message ...
I am still having to select the library, otherwise the VBA project will not
run and stops at:

rs.Open "table1", cn, adOpenKeyset, adLockOptimistic, adCmdTable


"Jim Thomlinson" wrote:

You want to use Late Binding as demonstrrated by Tim. Early binding binds the
dll at design time where as Late Binding binds the dll at run time. So use...

'late binding - does not require VBA Project reference to ADO library
Dim oRS as Object
set oRS = CreateObject("ADODB.Recordset")
--
HTH...

Jim Thomlinson


"Brent" wrote:

Okay I already have it as the lazy way, but I still have to go to
Tools-References and pick A.D.O. 2.8 library. Is there a way that I don't
have to go to Tools-References and do this for each new workbook?

Brent


"Tim Williams" wrote:


'Early binding
Dim oRS as New ADODB.Recordset '(the lazy way using New)


vs

'late binding - does not require VBA Project reference to ADO library
Dim oRS as Object
set oRS = CreateObject("ADODB.Recordset")

--
Tim Williams
Palo Alto, CA


"Brent" wrote in message ...
Can you "#include" a dll file in an Excel routine using VBA or ADO? I am
trying to make a routine that a user can copy and paste, without any other
efforts. Right now they have to select two references for the routine to
work. I can not find the equivalent of #include for VBA/ADO. Thank you.

Brent





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
Navigating to Excel files over network slow, but not Word files Newbie123 Excel Discussion (Misc queries) 1 December 2nd 09 01:18 PM
Excel 2007 tmp files filling up drive with XLSM files Jim Excel Worksheet Functions 0 September 12th 08 03:31 PM
How to change default Open/Files of Type to "Microsoft Excel Files Tammy Excel Discussion (Misc queries) 2 January 14th 08 11:06 PM
how to default WritePassword under excel workbook property for any files as long as those files are the offsprings of the parent file George Excel Programming 0 October 5th 06 04:14 PM
Drive Erased, got Files back but only excel files scrambled, help. Shawnky Excel Discussion (Misc queries) 0 May 8th 06 07:26 PM


All times are GMT +1. The time now is 03:32 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"