Jump to content
Macro Express Forums

Can Macros type the password for an excel document


sunilvedula

Recommended Posts

Can macros type the password for an excel password protected Document?

Probably. It would depend exactly what you are trying to do. It's easy to activate a macro with a key combination and have it type some characters. You could possibly activate a macro based on the title of a pop-up window that is asking for a password, and have the macro type some characters. It gets more complicated if the macro has to figure out what excel document you are trying to access, and type a different password for each document.

 

Can you be more specific as to what you are trying to accomplish?

Link to comment
Share on other sites

Hi All,

 

Can macros type the password for an excel password protected Document? Also is it possible to run macros when windows is locked?

 

Here's a macro that should do what I think you're asking.

 

// It is written for ME Pro, but the commands for ME 3 should be very similar.

// This macro will enter a password to unprotect an Excel 2000 spreadsheet.

// For this demo it is activated with the hotkey <Ctl+Win+u> and runs only when Excel 2000 is in focus.

Keystroke Speed: 100 milliseconds // Set keyboard speed to be comfortably slow (with no performance hit, as this is an infrequent operation).

Text Type (Simulate Keystrokes): <ALT>t // Open Tools menu

Delay: 100 milliseconds

Text Type (Simulate Keystrokes): pp // > Protection > Unprotect sheet

Delay: 100 milliseconds

Text Type (Simulate Keystrokes): abcxyz // Enter the password. In this case 'abcxyz' - which of course you would not normally include in a Comment!

Delay: 100 milliseconds

Text Type (Simulate Keystrokes): <ENTER> // Press Enter key to close dialog and finish the macro.

Delay: 100 milliseconds

Text Box Display: Warning // The message reads as follows:

The sheet is of course now unprotected, allowing changes to be made.

So don't forget to protect it again at some stage, probably with another similar macro.

--

Terry, East Grinstead, UK

Link to comment
Share on other sites

Having a macro type a password is a fairly simple thing. (Look at the examples posted here by others.) However, there are some programs that, due to security, refuse to let a program like Macro Express type anything into their password fields.

 

Macro Express uses something called the Windows Hooks to send and receive keystrokes. Unfortunately, the Hooks are also used by malware programs called keyloggers. Any program can block access to the Windows Hooks by other programs and often, to "improve security", they do. Quicken is one such program. I cannot use a macro to enter a password into Quicken. Macros work elsewhere in the program.

 

I do not know if the Excel password dialog works this way. I'm just saying that if you are unable to get a macro to type the password it may be due to how the program is written.

Link to comment
Share on other sites

Probably you are right kevin. i have tried to open an excel document that has been protected with a password and it does not allow. But when i recorded the macro it could do it though i dont like recording. i am comfortable with scripting. that raised some questions that if when i record a macro it is able to type the password then i should be able to do it even through scripting editor. let me know your thoughts.

 

second question is we lock our systems whenever we are not at our system(ctrl+alt+del). all our computers are network based. my questin ws can we run macros when the system is locked. i have been able to open programs but unable to type anything when the system was locked. for eg i was able to open a notepad but unable to type anything in it and also unable to save it. Any advice pls. this becomes important because we want to load data from an application onto a database designed in access even before uses login in their shifts. we are trying to schedule a macro every morning at 6am so that it runs and loads all the data from the application to the database and makes it ready for all the use when they login. all this work macro express does it and i have written the program. But we would like it to work when the system is locked as none of us are available at that time. else some one else has to cme and unlock the system to run the macro which is not ht best alternative solution. Any suggestions ?

Link to comment
Share on other sites

second question is we lock our systems whenever we are not at our system(ctrl+alt+del). all our computers are network based. my questin ws can we run macros when the system is locked.

I do this regularly as follows:

- I have a macro that changes 2 registry settings to allow the computer to boot and log in automatically

- The macro then reboots the machine even though it is currently locked

- Once the machine has rebooted and logged in my Autostart macro undoes the 2 registry settings

so that the machine no longer logs in automatically

- The Autostart macro runs whatever macro(s) you need to run

- The macro finally locks the computer

 

Please refer to Running macros on a locked workstation

and the last message in More information for more details

Link to comment
Share on other sites

 Shutdown

Schdule this macro:

CODE
Write Registry Value "%T[1]%" into 
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\AutoAdminLogon
-- T1 contains 1

Write Registry Value "%T[99]%" into 
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultPassword
-- T99 contains your login password

Program Launch: "shutdown.exe" (Normal)
Parameters: -s reboot -f -l 1


Once rebooted, schedule this macro to run on startup:

CODE
Write Registry Value "%T[1]%" into 
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\AutoAdminLogon
-- T1 contains 0

Delete Registry Value: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultPassword

 

i am a bit confused to say. What i understand with this code is it copies the passwd, reboots the system and then relogin without passwd by deleting it. runs the macro and then locks the system. Am i right?

 

second thing is once it relogs in will it excute all the commands as it would like when we run it normally? Once the macro completes its work would it then close? If so can yu send me the detailed code for locking the system after the macro runs. Whatever code i see above is to reboot the system without password. Please help me understand.

Link to comment
Share on other sites

i am a bit confused to say. What i understand with this code is it copies the passwd, reboots the system and then relogin without passwd by deleting it. runs the macro and then locks the system. Am i right?

Yes.

second thing is once it relogs in will it excute all the commands as it would like when we run it normally?

It's exactly the same as your normal environment. So have this macro call a separate macro called, say, Unattended, and include in Unattended all the stuff you want to achieve.

Once the macro completes its work would it then close? If so can yu send me the detailed code for locking the system after the macro runs. Whatever code i see above is to reboot the system without password. Please help me understand.

Once Unattended has finished, include in my macro the final command "Lock Workstation" (I assume that command is available in ME3? - if not, let me know and I'll provide an alternative method), or Hibernate or Shutdown, whichever you want.

Link to comment
Share on other sites

Did you try the macro I wrote and tested for you?

 

--

Terry, East Grinstead, UK

 

Hi Terry,

 

Sorry forgot to mention abt that. It is not the sheet that is protected but the entire workbook is protected with a password. It means when i try to open the file "Test" it opens and the first window that is visible is password window. Here i am unable to type the password. If i record the macro as u suggested i was able to type but when i try to code it in scripting editor it does not work. IF you would like to have a view at my code let me know. I will paste it.

Link to comment
Share on other sites

Hi Terry,

 

Sorry forgot to mention abt that. It is not the sheet that is protected but the entire workbook is protected with a password. It means when i try to open the file "Test" it opens and the first window that is visible is password window. Here i am unable to type the password. If i record the macro as u suggested i was able to type but when i try to code it in scripting editor it does not work. IF you would like to have a view at my code let me know. I will paste it.

 

I don't understand why you're having a problem. It seems that you simply want to enter a known password (say abcxyz) when a password-protected workbook is opened and requests it, yes? Are you saying that a trivial macro like this doesn't work? It does for me.

 

Keystroke Speed: 50 milliseconds

Text Type (Simulate Keystrokes): abcxyz

Delay: 100 milliseconds

 

As Bob said four days ago, you need to be more specific about what exactly you are trying to do. And, yes, don't wait to be invited before posting script and code! It helps others understand more clearly. Just the bit that's not working as you expect, not your entire macro of course.

--

Terry, East Grinstead, UK

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...