Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Hide a textbox on open of Excel

I want to place a textbox over a few buttons telling the user they
must enable their macros for the worksheet to function. Once they
enable macros I'd like the textbox to hide itself - OnOpen I'm
thinking....

Then after the fiddle with the sheet and make updates I'd like to have
the textbox reappear for the next use BeforeClose probably.

I have this but it doesn't work:

Private Sub Workbook_Open()
TextBox1.Visible = False
End Sub


Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Hide a textbox on open of Excel

The opening of the Workbook may be too early in the start up process... what
happens if you try that code in the Activate event for the worksheet that
the TextBox is on?

--
Rick (MVP - Excel)


"brittonsm" wrote in message
...
I want to place a textbox over a few buttons telling the user they
must enable their macros for the worksheet to function. Once they
enable macros I'd like the textbox to hide itself - OnOpen I'm
thinking....

Then after the fiddle with the sheet and make updates I'd like to have
the textbox reappear for the next use BeforeClose probably.

I have this but it doesn't work:

Private Sub Workbook_Open()
TextBox1.Visible = False
End Sub


Thanks


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Hide a textbox on open of Excel

Looks like that code is in the thisworkbook module so you'll need to qualify
TextBox1 with the sheet. Following for ideas, code in three modules -

' worksheet module

Public Sub ShowObject(bShow As Boolean)
On Error Resume Next
Me.TextBox1.Visible = bShow
End Sub

' thisworkbook module

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
Sheet1.ShowObject True
Application.OnTime Now, "ReShow"
End Sub

Private Sub Workbook_Open()
Sheet1.ShowObject False
End Sub

'normal module
Sub ReShow()
Dim bSaved As Boolean
bSaved = ThisWorkbook.Saved
Sheet1.ShowObject False
ThisWorkbook.Saved = bSaved
End Sub

Regards,
Peter T



"brittonsm" wrote in message
...
I want to place a textbox over a few buttons telling the user they
must enable their macros for the worksheet to function. Once they
enable macros I'd like the textbox to hide itself - OnOpen I'm
thinking....

Then after the fiddle with the sheet and make updates I'd like to have
the textbox reappear for the next use BeforeClose probably.

I have this but it doesn't work:

Private Sub Workbook_Open()
TextBox1.Visible = False
End Sub


Thanks



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Hide a textbox on open of Excel

Peter

This work perfectly thanks!

-Steve

On Apr 9, 2:57*am, "Peter T" <peter_t@discussions wrote:
Looks like that code is in the thisworkbook module so you'll need to qualify
TextBox1 with the sheet. Following for ideas, code in three modules -

' worksheet module

Public Sub ShowObject(bShow As Boolean)
* * On Error Resume Next
* * Me.TextBox1.Visible = bShow
End Sub

' thisworkbook module

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
* * Sheet1.ShowObject True
* * Application.OnTime Now, "ReShow"
End Sub

Private Sub Workbook_Open()
* * Sheet1.ShowObject False
End Sub

'normal module
Sub ReShow()
Dim bSaved As Boolean
* * bSaved = ThisWorkbook.Saved
* * Sheet1.ShowObject False
* * ThisWorkbook.Saved = bSaved
End Sub

Regards,
Peter T

"brittonsm" wrote in message

...



I want to place a textbox over a few buttons telling the user they
must enable their macros for the worksheet to function. *Once they
enable macros I'd like the textbox to hide itself - OnOpen I'm
thinking....


Then after the fiddle with the sheet and make updates I'd like to have
the textbox reappear for the next use BeforeClose probably.


I have this but it doesn't work:


Private Sub Workbook_Open()
TextBox1.Visible = False
End Sub


Thanks- Hide quoted text -


- Show quoted text -


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
TextBox value to hide a row in another worksheet TDC Excel Programming 1 March 19th 07 08:09 AM
How to hide/show a textbox depending on cell value Sam Kuo Excel Programming 3 January 12th 07 07:02 AM
how do i hide columns in excel so no one can open them. brianb Excel Discussion (Misc queries) 2 February 5th 06 10:09 PM
How to hide a textbox filo666 Excel Programming 1 October 11th 05 10:31 PM
hide a textbox on a userform? Bill Lunney Excel Programming 2 July 31st 03 08:57 AM


All times are GMT +1. The time now is 05:48 PM.

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

About Us

"It's about Microsoft Excel"