Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Copying across VBE

I have a template workbook which runs a number of Macros
that get data from Access. I have added a reference to the
ADO library (in VBE Tools, Reference and ticked Microsoft
ActiveX Data Objects x.x Object Library).

However when I copy this workbook (in Windows Explorer)
the copy workbook contains all macros etc. but this
reference is no longer ticked.

Is there some way of copying a workbook so that this is
ticked. Alternatively is there a way I can run a macro or
something to set it automatically.

Thanks for your help.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Copying across VBE

References are stored in the workbook. Unless you mean it is shown as
MISSING because you open it in a location where the path to the reference is
not valid (and that is not what you have said), then it is unusual that
copying from windows explorer would cause the reference to become unchecked.

--
Regards,
Tom Ogilvy

"Brian C" wrote in message
...
I have a template workbook which runs a number of Macros
that get data from Access. I have added a reference to the
ADO library (in VBE Tools, Reference and ticked Microsoft
ActiveX Data Objects x.x Object Library).

However when I copy this workbook (in Windows Explorer)
the copy workbook contains all macros etc. but this
reference is no longer ticked.

Is there some way of copying a workbook so that this is
ticked. Alternatively is there a way I can run a macro or
something to set it automatically.

Thanks for your help.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 459
Default Copying across VBE

Consider changing your code to use late binding. As a hint, here's
some side by side examples:

Option Explicit

Private Const strPATH As String = "C:\Documents and Settings\jamiec\My
Documents\New_Jet_DB.mdb"

Sub TestLateBound()
Dim oConn As Object
Dim oRs As Object
Dim strSql As String

Set oConn = CreateObject("ADODB.Connection")

With oConn
.CursorLocation = 3 ' adUseClient
.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & strPATH
.Open
End With

strSql = "SELECT RefID, Surname" & _
" FROM PersonalDetails"

Set oRs = oConn.Execute(strSql)

' <code

oRs.Close
oConn.Close

End Sub

Sub TestEarlyBound()

Dim oConn As ADODB.Connection
Dim oRs As ADODB.Recordset
Dim strSql As String

Set oConn = New ADODB.Connection

With oConn
.CursorLocation = adUseClient
.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & strPATH
.Open
End With

strSql = "SELECT RefID, Surname" & _
" FROM PersonalDetails"

Set oRs = oConn.Execute(strSql)

' <code

oRs.Close
oConn.Close

End Sub

--

"Tom Ogilvy" wrote in message ...
References are stored in the workbook. Unless you mean it is shown as
MISSING because you open it in a location where the path to the reference is
not valid (and that is not what you have said), then it is unusual that
copying from windows explorer would cause the reference to become unchecked.

--
Regards,
Tom Ogilvy

"Brian C" wrote in message
...
I have a template workbook which runs a number of Macros
that get data from Access. I have added a reference to the
ADO library (in VBE Tools, Reference and ticked Microsoft
ActiveX Data Objects x.x Object Library).

However when I copy this workbook (in Windows Explorer)
the copy workbook contains all macros etc. but this
reference is no longer ticked.

Is there some way of copying a workbook so that this is
ticked. Alternatively is there a way I can run a macro or
something to set it automatically.

Thanks for your help.

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
copying excelguy[_2_] Excel Discussion (Misc queries) 1 October 21st 09 10:42 PM
copying scott Excel Worksheet Functions 2 August 20th 08 07:22 PM
copying the Hyperlink function result without copying the actual formula mcheng Excel Worksheet Functions 2 June 9th 07 02:43 AM
copying a row Excel Greenie[_2_] Excel Discussion (Misc queries) 1 May 21st 07 04:11 AM
Copying data down to next dirty cell, then copying that data slarson Excel Programming 0 September 15th 03 09:19 PM


All times are GMT +1. The time now is 09:30 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"