View Full Version : save userform and continue later
ironj32
02-15-2007, 01:27 PM
wondering if there is a code to save the values/data in a UserForm so that the user can close the workbook and then open back up and complete at a later time?
Thanks!
mdmackillop
02-15-2007, 01:33 PM
You could add a button to write code to a temporary worksheet. On opening the userform, Initialize can check for its existence, and if found, write the values to the form and delete the temporary sheet.
whitewidow
02-18-2007, 07:28 PM
You could add a button to write code to a temporary worksheet. On opening the userform, Initialize can check for its existence, and if found, write the values to the form and delete the temporary sheet.
how would this be done
Brandtrock
02-19-2007, 01:17 AM
You could also set the Tag property of any control with a value entered equal to that value and fill it back in when the form gets activated again.
Regards,
Charlize
02-19-2007, 02:06 AM
Try this ...
Charlize
Bob Phillips
02-19-2007, 02:28 AM
Here is a simple example that saves all of the controls in a form on closedown
Private Sub UserForm_Terminate()
Dim oSaved As Worksheet
Dim oCtl As Control
Dim i As Long
On Error Resume Next
Set oSaved = Worksheets("SaveUF")
On Error GoTo 0
If oSaved Is Nothing Then
Worksheets.Add.Name = "SaveUF"
Set oSaved = Worksheets("SaveUF")
End If
oSaved.Cells.ClearContents
With Me
i = 1
For Each oCtl In .Controls
oSaved.Cells(i, "A").Value = oCtl.Name
On Error Resume Next
oSaved.Cells(i, "B").Value = oCtl.Caption
oSaved.Cells(i, "C").Value = oCtl.Value
On Error GoTo 0
i = i + 1
Next oCtl
End With
End Sub
lucas
02-19-2007, 06:10 AM
Is there any reason that custom document properties couldn't be used for this?
Bob Phillips
02-19-2007, 06:40 AM
No there isn't; as there is no reason Excel defined names COULDN'T; as there is no reason the registry COULDN'T; as there is no reason .ini files COULDN'T; as there is no reason text files COULDN'T; as there is no reason ...
They are all just receptacles for the information.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.