ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Password exposure (https://www.excelbanter.com/excel-programming/289385-password-exposure.html)

Joe Bannister

Password exposure
 
Hello all,

I have a macro that does various things and then saves
the new spreadsheet under a new name.

The code is as follows:

Sheets("MON AFT").Select
thisFilename = "C:\headoffice\"
thisFilename = thisFilename & CStr(Range("BW3"))
thisFilename = thisFilename & "_04_abcsheet"
ActiveWorkbook.SaveAs thisFilename

The users are not the most diligent and may access the
original file and run the macro again. When it comes to
save it tells them that the file already exists, do they
want to overwrite? It's possible they will say no.

If they do i get an error and the programming is exposed
which contains details of the passwords. Is there a way
of stopping this happening?

Cheers

Joe


Bob Phillips[_6_]

Password exposure
 
Joe,

Try this

Sheets("MON AFT").Select
thisFilename = "C:\headoffice\"
thisFilename = thisFilename & CStr(Range("BW3"))
thisFilename = thisFilename & "_04_abcsheet"
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:=thisFileName
Application.DisplayAlerts = True

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Joe Bannister" wrote in message
...
Hello all,

I have a macro that does various things and then saves
the new spreadsheet under a new name.

The code is as follows:

Sheets("MON AFT").Select
thisFilename = "C:\headoffice\"
thisFilename = thisFilename & CStr(Range("BW3"))
thisFilename = thisFilename & "_04_abcsheet"
ActiveWorkbook.SaveAs thisFilename

The users are not the most diligent and may access the
original file and run the macro again. When it comes to
save it tells them that the file already exists, do they
want to overwrite? It's possible they will say no.

If they do i get an error and the programming is exposed
which contains details of the passwords. Is there a way
of stopping this happening?

Cheers

Joe




humejap[_2_]

Password exposure
 
If your code contains passwords I would also protect the VBA project a
follows;

In the VBA Editor select the workbook in the Project Explorer pane an
then select Tools/VBAProject properties ( this assumes you have no
renamed the project ).

On the Protection tab, check the Lock Project for Viewing checkbox an
enter and confirm a password ( don't forget this as without it yo
won't be able to edit your code ).

Now you won't be able to view the code without entering this password

--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 12:17 PM.

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