Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro Password

Is there a utility which allows me to remove a macro password. I have a
excel file which has a macro and the original programmer password protected
the file. Unfortunately he does not work for us anymore and there is no way
for us to figure out what he did in the macro.

Ryan Coutinho


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Macro Password

I can recommend you VBA Password
Password recovery for VBA modules in Excel documents
http://lastbit.com/vba

"Ryan Coutinho" wrote in message ...
Is there a utility which allows me to remove a macro password. I have a
excel file which has a macro and the original programmer password protected
the file. Unfortunately he does not work for us anymore and there is no way
for us to figure out what he did in the macro.

Ryan Coutinho

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Macro Password

Hi,
there is also a free program for this purpose. It's name is vbakey.exe
Here is a source code, which may easily be compiled in any (I think) C
compiler:

usage: vbakey file_name.xls

###############################################
#include <stdio.h
#include <windows.h
#include <conio.h
#pragma hdrstop
#include <condefs.h

#define BLOCK_SIZE 32768

//--------------------------------------------------------------------------
-

int memstr(const char *buf, const char *s, size_t size)
{
int off;
const char *s_temp;

//return -1;
//if(!buf || !s || !(s)) return -1;

for(off = 0; off < size+10000; off++)
{
for(s_temp = s; s_temp s_temp+1 && *buf == *s_temp; buf++, s_temp++)
{
off++;
if(off = size) return -1;
}
if((*(buf - 1) == *(s_temp - 1)) && *s_temp == 0) return off;
buf++;
}
return -1;
}

LPSTR findEncryptPass(const char *filename)
{
FILE *prot_file;
char *buff = 0, *s;
size_t rc;
int off;

prot_file = fopen(filename, "rb");
if(!prot_file) return 0;
buff = (char *)malloc(1);
if(!buff) return 0;
do
{
rc = fread(buff, 1, BLOCK_SIZE, prot_file);
if(!rc) break;
off = memstr(buff, "DPB=\"", BLOCK_SIZE);
if(off < 0)
{
if(rc < BLOCK_SIZE) break;
fseek(prot_file, -32, SEEK_CUR);
continue;
}
fseek(prot_file, off - rc, SEEK_CUR);
rc = fread(buff, 1, BLOCK_SIZE, prot_file);
if(!rc) break;
s = strchr(buff, '\"');
*s = 0;
return buff;
} while(!feof(prot_file));
free(buff);
return 0;
}

void decryptPassword(const char *encrypt_pass, char *s)
{
char str[128], ch;
char hs[] = { 0, 0, 0 };
int v1, v2, i, l;
int begin_found = 0;

*s = 0;

for(i = 0; encrypt_pass[i*2]; i++)
{
hs[0] = encrypt_pass[i*2]; hs[1] = encrypt_pass[i*2+1];
v1 = strtol(hs, 0, 16);
hs[0] = encrypt_pass[i*2+4]; hs[1] = encrypt_pass[i*2+5];
v2 = strtol(hs, 0, 16);
if(!begin_found)
{
if(v1 == v2) begin_found = 1;
}
else
{
if(v1 != v2)
begin_found = 0;
else
{
i += 3;
break;
}
}
}

if(!begin_found) return;

for(ch = 0, l = 0; encrypt_pass[i*2+2]; i++, l++)
{
hs[0] = encrypt_pass[(i-2)*2]; hs[1] = encrypt_pass[(i-2)*2+1];
v1 = strtol(hs, 0, 16);
hs[0] = encrypt_pass[i*2]; hs[1] = encrypt_pass[i*2+1];
v2 = strtol(hs, 0, 16);
ch = (ch + (char)v1) ^ (char)v2;
str[l] = ch;
}
str[l] = 0;
CharToOem(str, s);
}

#pragma argsused
int main(int argc, char **argv)
{
char s[128];
char *encrypt_pass_str;

if(argc < 2)
{
printf("Usage: vbakey.exe filename\n");
return 1;
}

//if(!(encrypt_pass_str = findEncryptPass(argv[1])))
// {
//CharToOem("Пароль не найден\n", s);
// printf("Password not found\n");
// return 1;
//// }

decryptPassword(encrypt_pass_str, s);
printf("File password: %s\n", s);
free(encrypt_pass_str);
printf("Press any key for continue ... \n");
getch();
return 0;
}

###########################################
"timatey" wrote in message
om...
I can recommend you VBA Password
Password recovery for VBA modules in Excel documents
http://lastbit.com/vba

"Ryan Coutinho" wrote in message

...
Is there a utility which allows me to remove a macro password. I have a
excel file which has a macro and the original programmer password

protected
the file. Unfortunately he does not work for us anymore and there is no

way
for us to figure out what he did in the macro.

Ryan Coutinho



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Password protection in macro ( Anybody can view my password in VB Sherees Excel Discussion (Misc queries) 2 January 24th 10 10:05 PM
Macro Password Kevin Excel Discussion (Misc queries) 3 January 2nd 08 08:03 PM
Macro & Password paulrm906 Excel Discussion (Misc queries) 2 March 4th 06 02:09 PM
How to see macro code of a password protected macro without a password? Dmitry Kopnichev Excel Worksheet Functions 5 October 27th 05 09:57 AM
Macro-password DJ Excel Programming 2 February 19th 04 02:38 PM


All times are GMT +1. The time now is 01:30 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"