View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Set EnableAutoRecover to False

First, I had my test backwards!

if val(application.version) = 10 then
call OnlyThisSub
end if
(but you probably caught that!)

I don't have xl2k to test, but you could try this, too:

Dim myApp as Object 'generic object
....
if val(application.version) = 10 then
set myApp = Application
myapp.activeworkbook.enableautorecover = false
end if

Kent wrote:

On Jan 24, 9:09 pm, Dave Peterson wrote:
I'd create a new module with a single sub in it:

Option Explicit
Sub OnlyThisSub()
ActiveWorkbook.EnableAutoRecover = False
end Sub

Then in any other module, you can use:

if val(application.version) < 10 then
call OnlyThisSub
end if

The code in that separate module won't be run or even compiled.

(xl2002 is version 10, right???)

(and change the name to something nice <vbg)





Kent wrote:

I have an Excel application that is used by manys users with Excel
versions varying from Excel 2000 to Excel 2007. WIth the release of
Excel 2007, you must Digitally sign the project to enable macros.
However, Microsoft has a known bug that results in the users being
unable to save the file at times. The bug is a combination of
Autorecover and the digital signature. Microsoft's solution is to
disable autorecover. That can be done using:


ActiveWorkbook.EnableAutoRecover = False


However, since autorecovery was not available in Excel 2000, the
workbook has a compilaion error. I tried using conditinal compilation,
but I could not figure out how to use the Excel version in the
conditional compilation. I also thought I may be able to use
CallByName to solve this, but I couldn't figure out how to use that
with the ActiveWorkbook.EnableAutoRecover statement.


Any help will be MUCH appreciated.


--

Dave Peterson- Hide quoted text -

- Show quoted text -


Thank you VERY much Dave. I did not realize that it would not try to
compile a module unless the code within it was to be executed.
Obvious I guess. Your response is a great solution. Tank you again.
You have saved me a lot of grief!

Kent


--

Dave Peterson