Extracting macros from a worksheet

  • Thread starter Thread starter PCLIVE
  • Start date Start date
P

PCLIVE

Does anyone know if there is a way to extract macros from an excel worksheet
that cannot be opened due to a memory reference error? The exact error is
as follows.

____________________________________
The instruction at "0x3005c673" referenced memory at "0x00000018". The
memory could not be "written".

Click on OK to terminate the program
Click on CANCEL to debug the program
----------------------------------------------

Even though I get this error message, I can still see the worksheet behind
the error, but the error takes priority and then closes Excel. This error
occurs on multiple computers using just the one specific Excel file. So I'm
trying to find a way to extact the macro data, if possible.

Another strange thing I've noticed on the worksheet behind the error, is
that it has (Group) next to the file name on the title-bar at the top. Just
like if it was opened as a read-only file, it would say (Read-only) next to
the name. I never had "Group" next to the title when it was working
properly. What does the "Group" indicate?

Thanks in advanced for any help you can provide.
Paul,
 
Paul

The "Group" you see indicates that two or more worksheets are grouped together
so changes made on one sheet will be reflected on all.

To "Ungroup" sheets right-click on a sheet Tab and "Ungroup sheets".

You may have an Auto_Open macro trying to do something that is considered
illegal on grouped sheets.

Have you tried opening the workbook whilst holding down the SHIFT key to
prevent macros running?

Or Start>Run "excel.exe /safe"(no quotes) to open with nothing loaded.

Gord Dibben XL2002
 
Group means you have more than one worksheet selected.

Have you tried either disabling macros when you open the workbook or
pressing the shift key when you open the workbook to either prevent all
macros from running or just the Auto_Open/Worksheet_Open macro.

Regards

Trevor
 
Gord,

Thanks for the info. I have Excel setup to ask me about enabling and
disabling macros when opening a worksheet. I've tried both with no luck. I
get the same error when attempting to open this file.

The workbook that I'm opening has always worked before. That workbook and
macros were designed and written by me and they have been working for more
that 5 months now. There are only two worksheets in the workbook and I've
never had any reason to group them together, however, when the workbook
opens with the error, I can see that the two sheets are, in fact, selected.
In addition, a third sheet is now showing, which is labeled "Module1".
Since I can't navigate through the workbook because of the error, I do not
know what is on this sheet.

It is apparent that the workbook is at least opening partially. If I could
just find a way to get the macro text out without having to fully open the
file, then I'd be ok.

I don't recall having any kind of Auto_Open macro. However, I have tried
disabling macros upon opening the file. I've tried the Shift key while
opening, but it still prompts me about the macros to which I choose to
disable. I attempted the command with the " /safe", but that results in a
file not found. I'm using Excel 2000 on a Win2000 computer. I've also
tried a Windows Me computer. The error remains.

Thank you for any additional help you can offer.
Paul
 
-----Original Message-----
Does anyone know if there is a way to extract macros from an excel worksheet
that cannot be opened due to a memory reference error? The exact error is
as follows.

____________________________________
The instruction at "0x3005c673" referenced memory at "0x00000018". The
memory could not be "written".

Click on OK to terminate the program
Click on CANCEL to debug the program
----------------------------------------------

Even though I get this error message, I can still see the worksheet behind
the error, but the error takes priority and then closes Excel. This error
occurs on multiple computers using just the one specific Excel file. So I'm
trying to find a way to extact the macro data, if possible.

Another strange thing I've noticed on the worksheet behind the error, is
that it has (Group) next to the file name on the title- bar at the top. Just
like if it was opened as a read-only file, it would say (Read-only) next to
the name. I never had "Group" next to the title when it was working
properly. What does the "Group" indicate?

Thanks in advanced for any help you can provide.
Paul,


.
Paul,
You can try using vba to export the vb module. You will
probably have to open the workbook with vba and you may
get the same error.
You can run the code from one workbook and reference
the "broken" workbooks modules.
Paste this code in the code section of a button to run as
part of the click event in a new workbook and
change "oldbook" to the name of your "broken" book. When
you click the button your modules should be exported. I
think your code will stop when the error is generated but
it's worth a try.

Workbooks.Open "c:\oldbook.xls"
Workbooks("OldBook.xls").VBProject.VBComponents(1).Export
("c:\mod1.bas")
Workbooks("OldBook.xls").VBProject.VBComponents(2).Export
("c:\mod2.bas")
Workbooks("OldBook.xls").VBProject.VBComponents(3).Export
("c:\mod3.bas")
Workbooks("OldBook.xls").Close

Good luck
Jeff
 
Jeff,

Unfortunately, when the error occurs, Excel closes. So this prevents it
from exporting the macros.

If you can think of anything else, I'd appreciate it.
Thanks for the help
Paul
 
Hi Jeff,
Can you start up without macros. Don't indicate that you have
macros.

Alt+F11 to get to VBE
Ctrl+R to see macros for your project workbook.
--
 
David,

This was actually my post, but to answer your question...No. I can choose
to start up without macros, but as soon as the progress bar completes at the
bottom, the workbook appears and the error box appears over top of that.
The workbook is not accessible. The only thing I can do is press OK on the
error window which shuts down Excel. However, see Dave Peterson's reply.
OpenOffice worked great.

Thanks,
Paul
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top