![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Mar 2002
Posts: 60
|
I have formated a text box to display dates with the following line in the textbox code:
Private Sub TextBox1_Change() TextBox1.Text = Format(Range("$bi$4"), "dd-mmm-yy") End Sub It works fine until I print preview or print the page and then it goes back to date code and isnt formatted anymore. Anyone know how I can avoid this happening? TIA Dan. |
|
|
|
|
|
#2 |
|
Banned
Join Date: Feb 2002
Posts: 1,582
|
Hi Dan
What are you printing? the UseForm? |
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Mar 2002
Posts: 60
|
Hi Dave
No the textbox is on a spreadsheet. I could make it so the date appears in the cell below the textbox and then make the textbox not print but I wondered if there was a way not to cheat for a change. Dan. |
|
|
|
|
|
#4 |
|
Banned
Join Date: Feb 2002
Posts: 1,582
|
Dan, I am unable to generate this problem with Excel 2000, the date prints just as show. Anyway try this.
Private Sub TextBox1_Change() Dim strDate As String strDate = Range("A1") TextBox1 = Format(strDate, "dd/mmm/yy") End Sub |
|
|
|
|
|
#5 |
|
Board Regular
Join Date: Mar 2002
Posts: 60
|
Dave
Im using XP so I dont know if its a bug in the new version. Your new code still does the same. Grrrr looks like Ill have to cheat (as per usual) Thanks Dan. |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|