Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Save TextBox Entry after WorkBook is closed

Hello to all

I've got a problem with recovering textbox entries in a Userform after
the workbook is closed. I found the following code (from Tom Ogilvy),
which works perfectly when the Userform is closed, but it doesn't work
if I close and re-open the workbook. Ideally, I would like to store
(somewhere) the values that I enter in the textboxes and use them
after closing the specific workbook and opening it at another point in
time.

======<General Module =====
Public sString As String


======<Userform Module=====
Private Sub CommandButton1_Click()
sString = TextBox1.Text
Unload Me
End Sub


Private Sub UserForm_Initialize()
If Len(sString) 0 Then
TextBox1.Text = sString
Else
TextBox1.Text = ""
End If
End Sub


Can anybody help me with this one?

Many thanks in advance.
AP
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Save TextBox Entry after WorkBook is closed

Try this

Private Sub UserForm_Initialize()
TextBox1.Text =Worksheets("Sheet1").Range("A1").Value
End Sub

Private Sub UserForm_Terminate()
Worksheets("Sheet1").Range("A1").Value = TextBox1.Text
End Sub

change the worksheet area to suit.
--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"wpllc2004" wrote in message
om...
Hello to all

I've got a problem with recovering textbox entries in a Userform after
the workbook is closed. I found the following code (from Tom Ogilvy),
which works perfectly when the Userform is closed, but it doesn't work
if I close and re-open the workbook. Ideally, I would like to store
(somewhere) the values that I enter in the textboxes and use them
after closing the specific workbook and opening it at another point in
time.

======<General Module =====
Public sString As String


======<Userform Module=====
Private Sub CommandButton1_Click()
sString = TextBox1.Text
Unload Me
End Sub


Private Sub UserForm_Initialize()
If Len(sString) 0 Then
TextBox1.Text = sString
Else
TextBox1.Text = ""
End If
End Sub


Can anybody help me with this one?

Many thanks in advance.
AP



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
can I recover an excel file I closed and did not save bazsil,73 Excel Discussion (Misc queries) 1 August 7th 06 10:58 PM
copy worksheet from closed workbook to active workbook using vba mango Excel Worksheet Functions 6 December 9th 04 07:55 AM
Validating Entry into Textbox Brad[_11_] Excel Programming 1 December 4th 03 02:58 PM
restrict entry in a textbox to a range of values Dillonstar[_3_] Excel Programming 5 October 30th 03 05:00 PM
Highlighting or Selecting TextBox entry Gus Gazepis Excel Programming 3 September 8th 03 12:01 AM


All times are GMT +1. The time now is 04:28 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"