View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
John Wilson John Wilson is offline
external usenet poster
 
Posts: 550
Default How to: Make user click End User License Agreement acceptance

jason,

One way...................

Create a UserForm (UserForm1) with a text box or whatever for your
EULA.
On that form place two Buttons; CommandButton1 ("Accept") and
CommandButton2 ("Decline")

Copy this code to the Workbook code (Alt + F11 and DblClick on
"ThisWorkbook")

Private Sub Workbook_Open()
CheckEULA
End Sub

Right click on ThisWorkbook and choose Insert/UserForm
In the UserForm1 code:

Private Sub CommandButton1_Click() ' Accept
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Visible = True
Next ws
Worksheets("EULA").Range("A1") = "X"
Worksheets("EULA").Visible = xlVeryHidden
ThisWorkbook.Save
Unload UserForm1
End Sub
Private Sub CommandButton2_Click() ' Decline
Unload UserForm1
Application.DisplayAlerts = False
ThisWorkbook.Close
End Sub

And in a regular module:
Right click on ThisWorkbook and choose Insert/Module

Sub CheckEULA()
If Worksheets("EULA").Range("A1") = "" Then
UserForm1.Show
End If
End Sub

Now create a new sheet and name it EULA.
On that sheet, put a warning or whatever that they need to enable
macros for the workbook to open.
Lastly..the important part.
From the VBA Editor, select all of the sheets (except "EULA")
and set the sheet property to VeryHidden.

How it works.......
When the workbook opens (with macros enabled) it'll call the
CheckEULA sub. That sub will open the UserForm only if
it finds nothing in A1 on the EULA sheet.
If they decline, the workbook closes.
If they accept, All the sheets are unhidden and the EULA sheet
is made VeryHidden. Before doing that, it puts an "X" in A1 on
the EULA sheet and then saves the workbook. The next time
it opens, it will see the "X" in A1 and never show them the
EULA sheet or the UserForm.

Note: Any protection scheme like this can be bypassed by
an experienced user.

John


"jasonsweeney " wrote in
message ...
My company wants to send an internally created and sophisticated
spreadsheet to another company.

My boss wants to make sure that any users at the other company that use
the speadsheet have to click "accept" on one of those End User License
Agreement useforms that we all see when we use new software.

I have the text of the License Agreement in a word document.

Does anybody have some code out there for the userform and/or the code
that makes the user click "accept" only once, and has the spreadsheet
record that the user clicked "accept"?

thnx in advance.


---
Message posted from http://www.ExcelForum.com/