Saving a variable value

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have the following macro set to run when I open a workbook.

AutoSaveDetected = AddIns("Autosave Add-in").Installed

I use this to determine if a user has auto save installed. If they do, I
disable it and then enable it again in a BeforeClose procedure.

I have a problem in that if I disable auto save, I think the variable result
changes so that the value ends up as being always false when I run the
BeforeClose procedure and auto save never gets enabled.

Is there a way to have the variable store the value when the workbook is
opened instead of the current value?
 
Why not just disable it within the BeforeClose event as well. Put it in an
On Error Resume Next, and it won't matter if it is already disabled.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)
 
Hi Bob,

I'm just starting out with VBA.

Could you explain what this procedure does?

thanks
 
Private Sub Workbook_BeforeClose(Cancel As Boolean)
On Error Resume Next
'your code to disable the addin
On Error GoTo 0

'your code to enable it
End Sub



--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)
 

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

Back
Top