Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
How can I Run a query from VB macro with out affect current data in the same sheet?
How can I Run a SQL query from a VB macro and retrieve the imported data in a range of a sheet with out affect existing graphics and data? This sheet has data and graphics in range "A1:M20". I want to keep it there and the query table Destination property := Range("A50"). The query works fine, fill de query table in this range ("A50") but, deletes the graphics and any data that was in the sheet before executing the macro. With ActiveSheet.QueryTables.Add(Connection:="ODBC;DSN= Excel Files; _ DBQ=D:\Weekly reports\WEEKLY06.xls;DefaultDir=D:\Weekly reports", _ Destination:=Range("$A$50")) .CommandText = SQLQuery1 & SQLQuery2 .Refresh BackgroundQuery:=False End With Thanks -- oafdl ------------------------------------------------------------------------ oafdl's Profile: http://www.excelforum.com/member.php...o&userid=34908 View this thread: http://www.excelforum.com/showthread...hreadid=546532 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Get External Data - not editable using Query Wizard | Excel Discussion (Misc queries) | |||
AHHHH-Get Data from Multiple Excel workbooks | Excel Discussion (Misc queries) | |||
Closing File Error | Excel Discussion (Misc queries) | |||
data from one sheet to several in sequential order! | New Users to Excel | |||
Returning data to Excel sheet from MS query | Excel Discussion (Misc queries) |