Copyright message?

M

mevetts

Hi,

Is there any way of creating some form of copyright message that pop
up when a user opens a particular workbook? They then have to agree t
the terms to enter.

Thanks,

Mark
 
B

Bob Phillips

Not foolproof but one way

Private Sub Workbook_Open()
ans = MsgBox("© MEvetts", vbOKCancel)
If ans = vbCancel Then
ThisWorkbook.Close savechanges:=False
End If
End Sub

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code


--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)
 
M

mevetts

Hi,

I have pasted the code in, but I get an error message in Visual Basic
when I open the workbook.

It says - 'Compile error: Ambigious name detected: Workbook_Open'

Any thoughts?
 
D

Dave Peterson

You only get one workbook_open event.

So you'll have to extract Bob's code and merge it into your existing
workbook_open routine.
 
M

mevetts

It works nicely, thanks. It is dependent on the user enabling macros
but they need to do this anyway.

Thanks again
 
D

Dave Peterson

If macros aren't enabled, then none of your macros will work. (You can't use
macros in the workbook to enable macros for that workbook.)
 
M

mevetts

Is there any way of creating a line break in the text?

I would like two short pieces of info in the pop up, but I don't know
how to create a new paragraph. When I just hit enter in the code it
turns the line to red and gives and error message! :rolleyes:

Cheers.
 
D

Dave Peterson

Private Sub Workbook_Open()
ans = MsgBox("© MEvetts" & vblf & "second line" & vblf _
vblf & "another line", vbOKCancel)
If ans = vbCancel Then
ThisWorkbook.Close savechanges:=False
End If
End Sub
 
Top