Extract code from a closed workbook

pcc

Well-known Member
Joined
Jan 21, 2003
Messages
1,382
Office Version
  1. 2021
Platform
  1. Windows
Is it possible to extract VB code from a workbook that is closed? I have a workbook that will not open (I get the 'Not responding' message when it loads), and it has code in it that I would like to salvage.
Any ideas? Thanks.
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
By the way, I am using Office XP and Excel2002 (don't laugh!)
 
Upvote 0
You can't if the workbook is not able to open, try opening in safe mode (hold CTRL key while clikcing file)
 
Upvote 0
What happens if you run this from an empty file? Does the vba project show up if you step through this code?

VBA Code:
Sub jec()
 Set wb = GetObject("C:\Users\xxxx\Downloads\test.xlsx")
 wb.Close 0  
End Sub
 
Upvote 0
Solution
What happens if you run this from an empty file? Does the vba project show up if you step through this code?

VBA Code:
Sub jec()
 Set wb = GetObject("C:\Users\xxxx\Downloads\test.xlsx")
 wb.Close 0 
End Sub
Yes! That worked perfectly. Thank you very much. Regards pcc
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,207
Members
452,618
Latest member
Tam84

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top