View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_3_] Bob Phillips[_3_] is offline
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