Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Global Const for password


Hello,

I have a Global Const PWORD = "pwrd" declared in a wb module of Excel.
Then I have written a macro to Unprotect and another to re-Protect all
the wb sheets. Now I'ld like to create a macro to change the password
periodically. My question is: is it possible to re-declare PWORD
programmatically without using a file to store its value? Or, in other
words, how you'ld do?

Emiliano


--
eggpap

Excel 2003 on Vista HP System - can use VBA
------------------------------------------------------------------------
eggpap's Profile: http://www.thecodecage.com/forumz/member.php?userid=90
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=52031

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,420
Default Global Const for password

Something like this?

Sub ChangePassword()
Dim Line As String
Dim i As Long

With Application.VBE.ActiveVBProject.VBComponents("Modu le1").CodeModule

For i = 1 To .CountOfLines

Line = .Lines(i, 1)
If Left$(Line, 16) = "Global Const PWD" Then

.ReplaceLine i, "Global Const PWD As String = ""new_pwd"""
End If
Next i
End With
End Sub


--
__________________________________
HTH

Bob

"eggpap" wrote in message
...

Hello,

I have a Global Const PWORD = "pwrd" declared in a wb module of Excel.
Then I have written a macro to Unprotect and another to re-Protect all
the wb sheets. Now I'ld like to create a macro to change the password
periodically. My question is: is it possible to re-declare PWORD
programmatically without using a file to store its value? Or, in other
words, how you'ld do?

Emiliano


--
eggpap

Excel 2003 on Vista HP System - can use VBA
------------------------------------------------------------------------
eggpap's Profile: http://www.thecodecage.com/forumz/member.php?userid=90
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=52031



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Global Const for password


Many Thanks, I will try!


--
eggpap

Excel 2003 on Vista HP System - can use VBA
------------------------------------------------------------------------
eggpap's Profile: http://www.thecodecage.com/forumz/member.php?userid=90
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=52031

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
Const and VBA values sgl Excel Programming 4 May 19th 08 07:39 PM
Const Array Sören_Marodören Excel Programming 3 January 25th 07 01:09 PM
Global Password Change Sprinks Excel Programming 8 October 30th 06 06:04 PM
Not recognizing a Const Dan T[_3_] Excel Programming 7 July 18th 04 12:45 AM
crash changing const to public const BrianB Excel Programming 0 August 4th 03 10:13 AM


All times are GMT +1. The time now is 08:30 PM.

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"