Avoid Prompt to Save for Chart

K

Kevin2

BACKGROUND: I call a chart from an Access database. The chart tha
gets its data from from the Access database using an ODBC connectio
and a database query. I have the External Data Range Properties set t
"Refresh Data on File Open". This gets the current data for the char
from the database when opened.

PROBLEM: When users close the chart after viewing or printing, the
are prompted to save because the data changes when refreshed. Th
chart does not need to be saved since the data is refreshed every tim
it is opened. The users are not very computer literate are anoyed b
this prompt.

QUESTION: Can the chart be closed without saving and without promptin
the user?

I'm still an Excel beginner but love its charting abilities.

Thank You!
Kevi
 
J

Jon Peltier

Kevin -

I don't know about Access. In Excel you can use VBA to close a file
without saving it:

ThisWorkbook.Close False

or you can set the property that tells Excel it's already been saved:

ThisWorkbook.Saved = True

so Excel won't try to save it. Look for something similar in Access.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______
 
K

Kevin2

I tried setting the property "Thisworkbook.Saved = True" but it does
not help.

Which module and event would you put "ThisWorkbook.Closed False"?

Thanks.
 
J

Jon Peltier

Kevin -

Put this sub in the ThisWorkbook code module:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
ThisWorkbook.Saved = True
End Sub

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top