PDA

View Full Version : Solved: Accessing Target Spreadsheets existing VBA Code



haddy27
05-31-2007, 03:05 AM
I am looking to open a spreadsheet that has, as part of it's own VBA code, security that prevents copying and pasting, and then access this code that prevents the copying and comment it out, return to the Excel spreadsheet and copy and paste some data into a database.

I would run the code (to access target spreadsheet) from a database spreadsheet and don't know if this possible. I have tried the primitave way of using the macro recorder but after going through and accessing the VBA code, nothing is generated!?

Any help would be appreciated.

Haddy27

Bob Phillips
05-31-2007, 03:32 AM
Why not chgange the target spreadsheet to include a flag that bypasses its security, and then when you call it, you pass the flag.

haddy27
05-31-2007, 03:44 AM
Would you have an example of how I could do this as not attempted it before?

Also, the target spreadsheet is password protected, do you know the code to Unprotect the workbook when you know the password?

Thanks for your help

Bob Phillips
05-31-2007, 04:53 AM
Would you have an example of how I could do this as not attempted it before?

Also, the target spreadsheet is password protected, do you know the code to Unprotect the workbook when you know the password?
Manually or in code?

haddy27
05-31-2007, 05:04 AM
In code would be best for me if thats OK?

Bob Phillips
05-31-2007, 05:19 AM
Well the only method I know of is using SendKeys, which is flakey.

But if you use my other suggestion, you won't need this will you?

As to how to add the flag, we would need to see the code, and see which bit you don't want executed.

haddy27
05-31-2007, 07:06 AM
xld,

thanks for your help but I have managed to find another way round this, I'll close this thread

Thanks again