Hi
I want to execute "insert into xxx" in the excel, but found that
everytime I need to specify a Range although the sql statement won't return
any data back. I really don't want to display anything inside excel when the
insertion is executed. So that's basically what I want and did:
I wrote a small GUI form inside the
VB Editor of Excel. When the
user click some button on the form I will do an insertion. The following is
my code:
'oQts is the QueryTables collection of ActiveSheet
'lstConns let the user choose a connection string
'Range is where the data should go and my problem because I
don't want the data to appear on the excel
'sql is the insertion statement
Set oQt = oQts.Add(oQts.Item(lstConns.ListIndex + 1).connection,
Range("a1"), sql)
oQt.name = "MyTempTable"
'Execute the insertion
oQt.Refresh
Ok, that's what I tried to remove the "a1", I added after the code:
oQt.CancelRefresh
oQt.Delete
And the QueryTable is removed from the QueryTables but in the cell a1 I
still read "MyTempTable"
Is there anyway so that it won't appear on the excel? I tried to put the
Range("a1") as Range("") but the marco execution will fail