[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 5357
  • Last Modified:

Excel VBA - Not seeing code behind the worksheet

Hi:

I need to debug a legacy Excel VBA application with several worksheets. I open the VB editor, turn on Design Mode, right click on the sheet I want to debug in the Project panel on the left and choose 'View Code", nothing shows up. No even a dialog asking for password.

What have I missed?

Thanks.
0
sdc248
Asked:
sdc248
  • 4
  • 3
  • 2
1 Solution
 
AlanConsultantCommented:
Hi,

Perhaps the code is in a module rather than in one specific sheet?

In the VB Editor, scroll through the list of sheets on the left, and see if there are any modules listed there.

Also, could be in the workbook itself, rather than a specific sheet?

Alan.
0
 
MacroShadowCommented:
Did you click the yellow security message bar allowing content to run? If not no code will be visible.
0
 
sdc248Author Commented:
Hi Alan:
There is a module with the method now confirmed by my colleague to be the method triggered by clicking the button. But does this work? From my limited knowledge about VBA, there should be a xxxOnClick() method that listens to the OnClick event.

Hi MacroShadow:
I don't see any yellow security message bar. I am using Excel 2007, by the way. Could it be version differences?
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
MacroShadowCommented:
Do you get an error message when you click the command button?
0
 
sdc248Author Commented:
No. It just executes the code behind and displays the result on a separate worksheet.

From what I know, in design mode, double click the button would give me the code behind it. But I just can't get that to happen.
0
 
MacroShadowCommented:
That's weird. Are you dealing with controls on UserForms or in the Worksheets?
0
 
sdc248Author Commented:
Worksheets.
0
 
AlanConsultantCommented:
Hi,

Make sure the botton is not selected (click on a cell somewhere in the worksheet say), then right-click on the command button, and select 'assign macro'.

Click on the macro name in the list, and then 'Edit' on the right hand side.

That will take you to the module or wherever the code is (in the VB Editor).

From there, copy and paste the code to here, and let us know what it does, and what you want it to do instead.

Thanks,

Alan.
0
 
sdc248Author Commented:
That answers my question. Now I see how to track the method being called on clicking the button. I can take it from here. Thanks, Alan.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 4
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now