i have a multipage form with combo's, text, etc and when I save does not store anything... on open is blank.. like brand new... sugestions
Printable View
i have a multipage form with combo's, text, etc and when I save does not store anything... on open is blank.. like brand new... sugestions
That's right. Userform's do not store any of their data. You have to 'refresh' it after every start.
ok so what do I need to do store the data? use beforesave? and when start how do I "refresh" with activate?
Have a good look here at Debra's excellent web site
http://www.contextures.com/exceldata...pdateform.html
sorry but the site is too extensive to look for...
can anyone help in this exactly?
So, in your other thread, Zack was showing you how to populate the combobox. Just before closing the form, you need to write the data back to the spreadsheet. Normally I have a Save Or Exit Commandbutton to close the userform. Let's say that button is named cmdSave.
[VBA]Private Sub cmdSave_Click()
Sheet2.Range("A1").value = ComboBox1.value
Unload Me
End Sub[/VBA]
sorry but (forgetting the other thead) new form with several things... and when I make save by click as
[VBA]
Sub SaveDocument()
Application.ActiveWorkbook.Save
End Sub
[/VBA]
it does not store anything of what I've written... :( need something here?
I just create the form and the textboxes.... probably I have a simple problem but as new in this.... sorry
No, this has to be BEFORE you close the userform. The code I suggested should be on the userform code page.
that means to write in a worksheet...is not any other way to store things?
- You can use document variables.
- You can use built-in documernt variable, like Subject, author, etc. I tend to use these as you can go to document properties and edit them if you need.
- You can store the data in an external file. E.g. Just a simple text file. Then on exit, delete the file. Or a Random access file. Kinda like a text file, but very difficult to recognize data.
- You can write them to a hidden sheet, or a obscure location, like ZZZ999.
and with document variables how do I do it? or in the hidden sheet(can it be xlveryhiddeen)?
(I prefer the 1st)
thanks
Here's an example.
[VBA]Sub test()
Dim wb As Workbook
Dim docProps As DocumentProperties
Dim docProp As DocumentProperty
Set wb = ActiveWorkbook
Set docProps = wb.CustomDocumentProperties
With docProps
.Add Name:="CustomNumber", _
LinkToContent:=False, _
Type:=msoPropertyTypeNumber, _
Value:=1000
.Add Name:="CustomString", _
LinkToContent:=False, _
Type:=msoPropertyTypeString, _
Value:="This is a custom property."
.Add Name:="CustomDate", _
LinkToContent:=False, _
Type:=msoPropertyTypeDate, _
Value:=Date
End With
For Each docProp In docProps
Debug.Print docProp.Name, docProp.Value
Next
End Sub
[/VBA]
YesQuote:
in the hidden sheet(can it be xlveryhiddeen)?
sorry I'm to new to this loool
what is document properties and where the hell are they?
using excel 2007
What are the control names (textbox?) and what type of value are they?
after cracking my head made a sheet xlveryhidden and putted info there and got it back to the form's
thanks everyone