View Single Post
  #5   Report Post  
GWB Direct
 
Posts: n/a
Default

I can't get this to work. Where it says add names in the code do I put the
name of the workbook. I use macros but I'm not an expert as you can probably
tell.
Thanks in advance for you assistance.
--
Gary Baker


"Bob Phillips" wrote:

No there isn't.

You could do something like this

Const MaxRuns = 3

Private Sub Workbook_BeforeClose(Cancel As Boolean)
If cRuns <= MaxRuns Then
ThisWorkbook.Names.Add Name:="_RunLimit", RefersTo:=cRuns
End If
End Sub

Private Sub Workbook_Open()
Dim cRuns As Long
On Error Resume Next
cRuns = Evaluate(ActiveWorkbook.Names("_RunLimit").RefersT o)
cRuns = cRuns + 1
If cRuns MaxRuns Then
ThisWorkbook.Close savechanges:=False
End If
End Sub

which goes in the ThisWorkbook code module.

--
HTH

Bob Phillips

"GWB Direct" wrote in message
...
Most of my clients don't have the qualifications to diabled or modify a
macro. Could you direct me as to how it can be done. Is there a help

screen
in Microsoft that would show me how to create that type of macro.
Thanks for you assistance so far.

"Dave Peterson" wrote:

Not reliably. Almost anything you (well, I) would do would be based on

macros.

And macros can be disabled or modified. (Project protection for the

workbook
can be broken pretty simply.)



GWB Direct wrote:

I would like to send a workbook to a potential client but I would only

want
them to be able to use it 2 or 3 times. Is there a way to do this. I

am using
Xcel 2003. My operating system is Windows XP.
--
Gary Baker

--

Dave Peterson