Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

Vba And Excel


  • Please log in to reply
1 reply to this topic

#1 jbmoisin

jbmoisin

  • Members
  • 69 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Le Mans, France
  • Local time:11:50 AM

Posted 21 May 2007 - 11:19 AM

Okay, here's the deal. I have this problem concerning a protected excel sheet to work with my vb program. I need to protect the sheet because i don't want the users to change the value entered through my program. But every time i make the sheet protected , it seems that the program also can't change the values in the program.

So what i want to do is that, i want the worksheets to be protected from being modified by the users, and at the same time, let the program modify it.

To make you get the idea, here's the file that i'm working on. Déclaration x84

If you need to know how it works, ask me. Btw, this is a small interface i make for a visual control for Renault Megane's rear train's welding.

Edited by jbmoisin, 21 May 2007 - 11:29 AM.

Posted Image
For the team from the Eternal City, 90 minutes at Old Trafford must have seemed an eternity indeed.

BC AdBot (Login to Remove)

 


#2 jbmoisin

jbmoisin
  • Topic Starter

  • Members
  • 69 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Le Mans, France
  • Local time:11:50 AM

Posted 21 May 2007 - 05:10 PM

Nevermind. Got this from other forum.

Sub YourSubroutine()

On Error Goto ErrHndlr

'Unprotect the Sheet
Sheets(1).Unprotect Password:="dsi"

'
'Do all of your work here
'

'Protect the Sheet
Sheets(1).Protect Password:="dsi"

Exit Sub

ErrHndlr:
MsgBox "Error No: " & Err.Number & vbCrLf & _
"Description: " & Err.Description
Err.Clear

'Protect the Sheet
Sheets(1).Protect Password:="dsi"
End Sub


Note that the ErrHndlr part is just a failsafe.
Posted Image
For the team from the Eternal City, 90 minutes at Old Trafford must have seemed an eternity indeed.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users