![]() |
|
|
||||||||
| Site Links |
| Consulting |
| Knowledge Base |
| Training |
| Forum |
| Articles |
| Resources |
| Products |
| Cool Tools |
| Contact |
| About Us |
| Go to Page... |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
|
Solved: SaveAsUI.... cleanup before close.
So I have found some nifty code that will allow me to prevent users from saving the document under a different name or location (credit: OzGrid)
It seems to work fine until I try and do a little house keeping mid-stream. This is the original code: VBA:
VBA tags courtesy of www.thecodenet.com
I however want to hide a few sheets that might have been made visible via code. (I would really like to pass a variable to this bit of code so that it only tries to hide the sheets if they have been made visible - I would set the variable in the procedure that makes the sheets visible rather than going through the process of checking to see if they are visible) My attempt at the sheet hiding part is as follows: VBA:
VBA tags courtesy of www.thecodenet.com
This version yields an error: Block If without End If. If I back the line commented as "this line" up onto the end of the line commented as "to here" it works but doesn't hide sheet "ref" Thanks again. You guys rock! |
|
Local Time: 02:36 PM
Local Date: 05-19-2013 Location:
|
|
|
|
#2 |
|
Distinguished Lord of VBAX
|
VBA:
VBA tags courtesy of www.thecodenet.com
____________________________________________ Nihil simul inventum est et perfectum Abusus non tollit usum Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen! James Thurber |
|
Local Time: 08:36 PM
Local Date: 05-19-2013 Location:
|
|
|
|
#3 |
|
|
Doh!
![]() Thanks, Any ideas on passing this a variable? The following is the code that allows access to said sheets. VBA:
VBA tags courtesy of www.thecodenet.com
If I check the value of openSh when Workbook_BeforeSave runs it comes up false... |
|
Local Time: 02:36 PM
Local Date: 05-19-2013 Location:
|
|
|
|
#4 |
|
Distinguished Lord of VBAX
|
Set var1 as a Global variable and check that in the procedure.
You can improve that code VBA:
VBA tags courtesy of www.thecodenet.com
____________________________________________ Nihil simul inventum est et perfectum Abusus non tollit usum Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen! James Thurber |
|
Local Time: 08:36 PM
Local Date: 05-19-2013 Location:
|
|
|
|
#5 |
|
|
I could clean up my code.... (that is probably a foregone conclusion, chuckle)
Thanks. I actually managed to get my project to recognize that the sheets were made visible and hid them on save. Thank you so much. As time goes on I get farther and farther along before have to ask you guys for help. Maybe someday I'll be able to help others. |
|
Local Time: 02:36 PM
Local Date: 05-19-2013 Location:
|
|
![]() |
| Display Modes |
Linear Mode |
Switch to Hybrid Mode |
Switch to Threaded Mode |
|
|


