Solved

Excel - VBS script

Posted on 2001-08-13
5
625 Views
Last Modified: 2008-03-04
From my VBS script, I want to protect some columns and hide another column.  And of course I want to leave one unprotected.  What is the syntax for the hidden?

Thanks!
0
Comment
Question by:cmarshall
  • 3
5 Comments
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 6381543
'I suppose you have a valid variable for sheet object already.
' This switch visible and hide alternatively
mySheet.Visible = Not (mySheet.Visible)
0
 
LVL 1

Expert Comment

by:eeevans
ID: 6381564
For hiding columns use syntax similar to:

ActiveWorkbook.ActiveSheet.Range("D1").EntireColumn.Hidden = True

ActiveWorkbook.ActiveSheet.Range("A1:B1").EntireColumn.locked = True
ActiveWorkbook.ActiveSheet.Protect

This will protect columns A and B and leave C unprotected.  You can give the protect method a password string, but you must protect the sheet for the locked property to have any meaning and work.

Hope this helps,

eeevans
0
 

Author Comment

by:cmarshall
ID: 6381578
Thank you eeevans....  What resource would you recommend for the future?
0
 
LVL 1

Expert Comment

by:eeevans
ID: 6381662
You can ask these type of questions in the Microsoft newsgroups if you have access to newsgroups.  If not you they have a web interface for them on msdn online at:

http://msdn.microsoft.com/newsgroups/

and click on Office Solutions Development and then Excel and then Programming or in your news reader open microsoft.public.excel.programming.

Also you can always turn on the macro recorder by selecting Tools->Macros->Record New Macro in the toolbar and then do what you want to manually and then look at the code that was recorded for what you did manually.  It will help a lot with syntax etc.

Hope that helps,

eeevans
0
 
LVL 1

Accepted Solution

by:
eeevans earned 100 total points
ID: 6381825
And there's always the fine folks here at EE.

eeevans
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now