ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   External Data Updates (https://www.excelbanter.com/excel-programming/301219-external-data-updates.html)

No Name

External Data Updates
 
I have an excel template which pulls some data from my SQL server when
opened. I need to set it so that it only pulls up the data when first opened
from a template, but not after being saved as an xls file.

Any ideas?



Tom Ogilvy

External Data Updates
 
ActiveSheet.QueryTables(1).Delete

after you refresh the data.

--
Regards,
Tom Ogilvy

<M.Streeks wrote in message
...
I have an excel template which pulls some data from my SQL server when
opened. I need to set it so that it only pulls up the data when first

opened
from a template, but not after being saved as an xls file.

Any ideas?





No Name

External Data Updates
 
Thanks for your help - I'm still not sure how to do it though.
Does that get pasted in verbatim? and where exactly do i put it?

The code that i use to populate the tables is in a module - i don't program
with excel very often, so i don't really know where every thing goes.



"Tom Ogilvy" wrote in message
...
ActiveSheet.QueryTables(1).Delete

after you refresh the data.

--
Regards,
Tom Ogilvy

<M.Streeks wrote in message
...
I have an excel template which pulls some data from my SQL server when
opened. I need to set it so that it only pulls up the data when first

opened
from a template, but not after being saved as an xls file.

Any ideas?







No Name

External Data Updates
 
Now i only need to know where to put it.

<M.Streeks wrote in message ...
Thanks for your help - I'm still not sure how to do it though.
Does that get pasted in verbatim? and where exactly do i put it?

The code that i use to populate the tables is in a module - i don't

program
with excel very often, so i don't really know where every thing goes.



"Tom Ogilvy" wrote in message
...
ActiveSheet.QueryTables(1).Delete

after you refresh the data.

--
Regards,
Tom Ogilvy

<M.Streeks wrote in message
...
I have an excel template which pulls some data from my SQL server when
opened. I need to set it so that it only pulls up the data when first

opened
from a template, but not after being saved as an xls file.

Any ideas?









Tom Ogilvy

External Data Updates
 
I would guess either in the open event of the template - you would have to
include code to do the query with backgroundrefresh set to false, the code I
gave you to delete the query table on that sheet (this all assumes you are
using a querytable). Then possibly save the template as a workbook with a
new name.

http://www.cpearson.com/excel/events.htm

--
Regards,
Tom Ogilvy

<M.Streeks wrote in message ...
Now i only need to know where to put it.

<M.Streeks wrote in message

...
Thanks for your help - I'm still not sure how to do it though.
Does that get pasted in verbatim? and where exactly do i put it?

The code that i use to populate the tables is in a module - i don't

program
with excel very often, so i don't really know where every thing goes.



"Tom Ogilvy" wrote in message
...
ActiveSheet.QueryTables(1).Delete

after you refresh the data.

--
Regards,
Tom Ogilvy

<M.Streeks wrote in message
...
I have an excel template which pulls some data from my SQL server

when
opened. I need to set it so that it only pulls up the data when

first
opened
from a template, but not after being saved as an xls file.

Any ideas?












All times are GMT +1. The time now is 02:50 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com