View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jamie Collins Jamie Collins is offline
external usenet poster
 
Posts: 593
Default share adodb connection in excel

Marek wrote ...

in my module i want to have variable with connection parameters

for example i want to once describe this variable somewhere in module

cons = "provider=Microsoft.Jet.OLEDB.4.0;" & _
"data source=db.mdb;"

and after that i simply want to use this string variable in each sub

maybe i must to use constants ?


Sure, that's what I'd do:

Private Const CONN_STRING As String = "" & _
"provider=Microsoft.Jet.OLEDB.4.0;" & _
"data source=db.mdb;"

although it's unlikely to be needed by multiple subs e.g. if you have
a property that supplies the ADO Connection object.

Jamie.

--