Solved

Automatically making an excel sheet

Posted on 2006-10-25
4
147 Views
Last Modified: 2010-04-30
I've got everything else down, i just need to stop the user from selecting certain cells (without hiding them).  In excel this is done by going through the menus like so:
Tools -> Protection -> Protect Sheet ...

The menu comes up and then you can select from the list with the label
Allow all users of this worksheet to:
|_| Select Locked Cells
|_| Select unlocked Cells

allong with others
By default, the user is allowed to select any cells even though they are protected.  I need to make it in my generated xls file that the user cannot select the locked cells.  How is this done?

As a note, I'm using vb6 with the office11 excel library.  Thanks.
-Chris
0
Comment
Question by:lillockey
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 29

Expert Comment

by:leonstryker
ID: 17806884
Use the Macro recorder in Excel and then look at the code it generates.

Leon
0
 
LVL 93

Accepted Solution

by:
Patrick Matthews earned 500 total points
ID: 17811290
Assuming you have a variable, ws, of type Worksheet:

With ws
    .Protect Password:="pw", DrawingObjects:=True, Contents:=True, Scenarios:=True
    .EnableSelection = xlUnlockedCells
End With

Patrick
0
 

Author Comment

by:lillockey
ID: 17812843
THANK YOU :).  That was EXACTLY what I was looking for.
0
 
LVL 93

Expert Comment

by:Patrick Matthews
ID: 17813006
You're welcome :)
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
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…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…
Suggested Courses
Course of the Month6 days, 17 hours left to enroll

623 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