PDA

View Full Version : [SOLVED] Find the code behind



mayur_m3
03-18-2005, 02:40 AM
Hi
Me a novice both to the forum and the VBA world

I had this problem opening a excel file to check for code within
How do I check what has been written in the VBA code?

I have opened the Excel file and the VBE
But the code doesn't show up!
How do I check what is written for each cell

Thanx & Regards

Regouin
03-18-2005, 03:47 AM
Hi and welcome to VBAX,

I think you are confusing 2 things here, the VBA code and the excel code. The VBA code is written in the VBE and can be in one of the different sheets, models or userforms, dependant on the type of code.
When you use formulas within excel then that has nothing to do with VBA and they can be seen by putting your cursor on the cell. excel formulas can be clarified by the auditing tools or the explode-addin from xl-logic.com.
If I didnt answer your question please rephrase the question.

Frank

mayur_m3
03-18-2005, 03:56 AM
I have the VBE open and the excel file too
I can see in the respective explorer windows the
Sheets and the properties

Where from the Sheet do I find the code
I also have the Personal.xls file
Now the code seams to be in the Personal.xls file

How do I find which cell/ button on this file (one I am working with) has what code?

johnske
03-18-2005, 04:00 AM
Hi mayur, and welcome to VBAX.

As you've found how to open the VBE window... to look at any code - Click View/Project Explorer. Click any "+"s (pluses) in the pane that shows up.

Now double-click anything you see in that pane (Sheet1, Sheet2, Sheet3, ThisWorkbook, Modules) to see the code (if there's any) in any of those code modules/code panes that appear. If there's a form showing in the Project Explorer pane, right-click it and select 'view code'.

To look at any worksheet code (code embedded in the spreadsheet) in the main Excel window. Go to View/Formula Bar, select a cell, and if there's code in the cell you'll see it in the formula bar. Another way is to go to Edit/Find, make sure that 'Look In Formulas' is selected and type in = (equals), if there are any formulas on the spreadsheet they'll be selected and they can be read in the formula bar.

HTH
John :)

mayur_m3
03-18-2005, 04:15 AM
Thanx johnske

That was a great clue to find some code
But how do I find code behind a button on the excel sheet?

johnske
03-18-2005, 04:28 AM
It depends on what type of button it is, but it will usually either be in the sheet module for that sheet or in a "standard" module.

John

mayur_m3
03-18-2005, 04:38 AM
I didn't get what by the button type U mean
It is a command button as in VB

The code lies in the personal.xls file
How do I click this button and get the code behind in the VBE
I need this to study (or debug) the code not necessarily execute it

johnske
03-18-2005, 04:52 AM
Hi mayur,

If it's on the sheet, it's either an OLE command button created using the "Controls" toolbar (in which case the code will be in the code module for that worksheet) OR, it's a "forms" command button, in which case the code will be in a standard module.

HTH
John

mayur_m3
03-18-2005, 05:02 AM
Hi John

The problem now is I am able to get the macro name
This cause once I click the button it gives an error which says the filename personal.xls (reported not in place) and macro name

Now I can open the file code.
But how do I change the file this is refering as not in place to the file personal.xls I have

Thanx n Regards
mayur

johnske
03-18-2005, 05:06 AM
When you look in the Project Explorer pane do you see a VBAProject (PERSONAL.XLS) ?

mayur_m3
03-18-2005, 05:19 AM
Ya for I have opened the personal.xls file too!

Paleo
03-18-2005, 05:29 AM
Hi mayur,

if the button is in the worksheet, simply click on "View" -> "CommandBars" -> "Visual Basic"
then choose http://www.mugrs.org/imgs/ModoEstrutura.gif

now choose http://www.mugrs.org/imgs/Ferramentas.gif "tools"

and then http://www.mugrs.org/imgs/ExibirCodigo.gif "show code".

And if it is a form in the VBE, at the projct explorer double-click on forms and double-click the form you see. Now just double-click any button you see.

mayur_m3
03-18-2005, 07:39 AM
Hi

How do I update the links (in the Edit> Links menu)
The file Personal.xls my excel file is referencing is a wrong location

Regards
Mayuresh

mayur_m3
03-19-2005, 11:54 AM
hi

Can u now guide me how o I see cod behind the button on th excel sheet
Clicking it says personal.xls!macroname not found
It searches fo the file in wrong location
How do i change the file location link in this sheet!

Regards

Anne Troy
03-19-2005, 11:57 AM
Your personal.xls file should be in a folder called XLSTART

You should NOT move your personal.xls file; it is (practically) a system file.

Please read:

About personal.xls (http://www.vbaexpress.com/forum/articles.php?action=viewarticle&artid=8)

and

Lesson 1 of VBA Training (http://www.vbaexpress.com/training/lesson01.htm)

This should give you a better understanding.

mayur_m3
03-21-2005, 01:44 AM
tHANKS ALL

I would be going through the links given by dreamboat and ask for more help as needed

rgds,
mayur

Regouin
03-21-2005, 01:46 AM
You can mark your thread solved via thread tools :) keeps the boards clean.


frank