Consulting

Results 1 to 17 of 17

Thread: Find the code behind

  1. #1

    Find the code behind

    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

  2. #2
    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

  3. #3

    Find Code Behind

    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?

  4. #4
    Administrator
    Chat VP
    VBAX Guru johnske's Avatar
    Joined
    Jul 2004
    Location
    Townsville, Australia
    Posts
    2,872
    Location
    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
    You know you're really in trouble when the light at the end of the tunnel turns out to be the headlight of a train hurtling towards you

    The major part of getting the right answer lies in asking the right question...


    Made your code more readable, use VBA tags (this automatically inserts [vba] at the start of your code, and [/vba ] at the end of your code) | Help those helping you by marking your thread solved when it is.

  5. #5

    Find Code Behind

    Thanx johnske

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

  6. #6
    Administrator
    Chat VP VBAX Guru johnske's Avatar
    Joined
    Jul 2004
    Location
    Townsville, Australia
    Posts
    2,872
    Location
    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
    You know you're really in trouble when the light at the end of the tunnel turns out to be the headlight of a train hurtling towards you

    The major part of getting the right answer lies in asking the right question...


    Made your code more readable, use VBA tags (this automatically inserts [vba] at the start of your code, and [/vba ] at the end of your code) | Help those helping you by marking your thread solved when it is.

  7. #7

    Code Behind

    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

  8. #8
    Administrator
    Chat VP VBAX Guru johnske's Avatar
    Joined
    Jul 2004
    Location
    Townsville, Australia
    Posts
    2,872
    Location
    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
    You know you're really in trouble when the light at the end of the tunnel turns out to be the headlight of a train hurtling towards you

    The major part of getting the right answer lies in asking the right question...


    Made your code more readable, use VBA tags (this automatically inserts [vba] at the start of your code, and [/vba ] at the end of your code) | Help those helping you by marking your thread solved when it is.

  9. #9
    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

  10. #10
    Administrator
    Chat VP VBAX Guru johnske's Avatar
    Joined
    Jul 2004
    Location
    Townsville, Australia
    Posts
    2,872
    Location
    When you look in the Project Explorer pane do you see a VBAProject (PERSONAL.XLS) ?
    You know you're really in trouble when the light at the end of the tunnel turns out to be the headlight of a train hurtling towards you

    The major part of getting the right answer lies in asking the right question...


    Made your code more readable, use VBA tags (this automatically inserts [vba] at the start of your code, and [/vba ] at the end of your code) | Help those helping you by marking your thread solved when it is.

  11. #11
    Ya for I have opened the personal.xls file too!

  12. #12
    Administrator
    VP-Knowledge Base VBAX Master
    Joined
    Jan 2005
    Location
    Porto Alegre - RS - Brasil
    Posts
    1,219
    Location
    Hi mayur,

    if the button is in the worksheet, simply click on "View" -> "CommandBars" -> "Visual Basic"
    then choose

    now choose "tools"

    and then "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.
    Best Regards,

    Carlos Paleo.

    To every problem there is a solution, even if I dont know it, so this posting is provided "AS IS" with no warranties.

    If Debugging is harder than writing a program and your code is as good as you can possibly make
    it, then by definition you're not smart enough to debug it.




    http://www.mugrs.org

  13. #13
    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

  14. #14

    Find Code behind

    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

  15. #15
    Site Admin
    The Princess VBAX Guru Anne Troy's Avatar
    Joined
    May 2004
    Location
    Arlington Heights, IL
    Posts
    2,530
    Location
    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

    and

    Lesson 1 of VBA Training

    This should give you a better understanding.
    ~Anne Troy

  16. #16
    tHANKS ALL

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

    rgds,
    mayur

  17. #17
    You can mark your thread solved via thread tools keeps the boards clean.


    frank

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •