LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Can't change connection property on querytable

I have a Data Import set as a connection to another spreadsheet.

I'd like to be able to change the connected spreadsheet to another
spreadsheet, but nothing I do seems to change the connection string.

Here is the code:

With Sheets(1).QueryTables(1)
MsgBox .Connection
.Connection = Array(connect1, Range("path"), Range("File"),
connect2, connect3)
MsgBox .Connection
.CommandType = xlCmdSql
.CommandText = Array( "SELECT [F1], [F2 FROM [Combined File$] )
.Refresh BackgroundQuery:=False
End With

The msgbox shows me that the connection string is not being changed.
I can make the change manually just by editing the connection directly.
But in code, I can't make it happen. I've diddled with various other
properties (SourceDataFile, maintainconnection, enableediting, etc) but
nothing works.

Help
(Excel 2003)

The full connection string is:
Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=C:\Documents and
Settings\me\Combined File Dec 2008.xls;Mode=Share Deny Write;Extended
Properties="HDR=YES;";Jet OLEDB:System database="";Jet OLEDB:Registry
Path="";Jet OLEDB:Engine Type=35;Jet OLEDB:Database Locking Mode=0;Jet
OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Global Bulk Transactions=1;Jet
OLEDB:New Database Password="";Jet OLEDB:Create System Database=False;Jet
OLEDB:Encrypt Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;Jet
OLEDB:Compact Without Replica Repair=False;Jet OLEDB:SFP=False
 
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
querytable connection fails in Excel 2007 kk45 Excel Programming 0 March 19th 08 03:41 PM
QueryTable connection using ADO Recordset jfs Excel Programming 3 November 27th 06 01:54 AM
querytable connection TxRaistlin Excel Programming 2 February 9th 05 01:49 PM
Find the contents of a Connection property of the QueryTable objec SPYREN Excel Programming 4 October 28th 04 04:03 PM


All times are GMT +1. The time now is 06:03 AM.

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"