Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Running code before saving workbook

Hi,

I want to run some code to hide sheets in a workbook just before it saves...
no problem - I just run this code in the "Thisworkbook" using "before save".
However I then want to open them up again immediately after the workbook as
saved. This is to ensure the user cannot save a version of the workbook with
the sheets visible, but doesn't then have to reenter his password and user
name to run some other code that I've written to open up the sheets again.

also what are the settings on a combobox to prevent the user editing entries
(the list of user names) that I've loaded using "additem"...if he does edit
his user name then it confuses the VLookup statement that the combobox feed
when it changes. I've tried every setting under combobox and nothing seems to
prevent this.

I also require that the user type in his password into a text box when he
selects his user name in the combobox drop down. The text box for the
password has "Enter Password" loaded in to it when the combobox
changes...however it would be nice to have this text highlighted such that
when he types, he types immediately over it rather than having to delete
these words first.

again tried every setting for text boxes and used "set focus" to the text
box when the combo box changes...no luck...

thanks for your help...Chris
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default Running code before saving workbook

It's best to address one issue per post.

Re the first you might try using Ontime:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
Sheet2.Visible = xlSheetHidden
Application.OnTime Now, "UnhideSheets"
End Sub

''In a standard module
Sub UnhideSheets()
Sheet2.Visible = xlSheetVisible
End Sub


--
Jim
"Chris Gorham" wrote in message
...
Hi,

I want to run some code to hide sheets in a workbook just before it
saves...
no problem - I just run this code in the "Thisworkbook" using "before
save".
However I then want to open them up again immediately after the workbook
as
saved. This is to ensure the user cannot save a version of the workbook
with
the sheets visible, but doesn't then have to reenter his password and user
name to run some other code that I've written to open up the sheets again.

also what are the settings on a combobox to prevent the user editing
entries
(the list of user names) that I've loaded using "additem"...if he does
edit
his user name then it confuses the VLookup statement that the combobox
feed
when it changes. I've tried every setting under combobox and nothing seems
to
prevent this.

I also require that the user type in his password into a text box when he
selects his user name in the combobox drop down. The text box for the
password has "Enter Password" loaded in to it when the combobox
changes...however it would be nice to have this text highlighted such that
when he types, he types immediately over it rather than having to delete
these words first.

again tried every setting for text boxes and used "set focus" to the text
box when the combo box changes...no luck...

thanks for your help...Chris



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
Saving workbook in code harkit Excel Programming 1 August 1st 05 01:54 PM
Programatically saving workbook (or worksheet) without the code Hugh Excel Programming 4 October 22nd 04 12:03 AM
Running Code on Each Sheet in an Excel Workbook bearie Excel Programming 2 February 6th 04 03:54 PM
SAVING A COPY OF WORKBOOK W/O THE CODE IN IT gr8guy Excel Programming 2 January 22nd 04 10:18 AM
Saving a Workbook without code KimberlyC Excel Programming 1 August 21st 03 07:07 PM


All times are GMT +1. The time now is 12:19 AM.

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"