ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Same variable name in different projects (https://www.excelbanter.com/excel-programming/301821-same-variable-name-different-projects.html)

Anson[_2_]

Same variable name in different projects
 
I have a program that makes a workbook to copy itself without saving it. This workbook has a Global Variable "PWD" to manage the password of a sheet in the workbook. I want to assign a different password for the copy as my program coping itself and lock the sheet with a new password in the new workbook. How do I refer to "PWD" in the new workbook as supposed to the orginal workbook?

GJones

Same variable name in different projects
 
Hi Anson;

One way you can achieve this is to make a hidden worksheet
and hold the value for the password in one of the cells.
Then reference the value by using the code

MyPassword = ThisWorkBook.Sheets("Ini").Range("A1")

Where the hiddne sheet is named Ini and the value is in
cell A1.

Then when the second workbook is crated just change the
value in the Ini range A1.

Thanks,

Greg

-----Original Message-----
I have a program that makes a workbook to copy itself

without saving it. This workbook has a Global
Variable "PWD" to manage the password of a sheet in the
workbook. I want to assign a different password for the
copy as my program coping itself and lock the sheet with a
new password in the new workbook. How do I refer to "PWD"
in the new workbook as supposed to the orginal workbook?
.



All times are GMT +1. The time now is 01:39 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com