Results 1 to 6 of 6
  1. #1
    ntambomvu is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Nov 2016
    Location
    Johannesburg south africa
    Posts
    91

    conventions in naming and using of macros

    Hello Chaps
    I am new to vba programming in access and excel

    About macros

    1. Is it customary to have a new module for each and every macro? or can I put all my macros in one module?

    2. About the module of macros that is saved in "personal.xlsb". i would like to use this as a " library " of general shortcuts. so i would like this module to contain many subroutines-
    will this be good practice?
    3. if a module is empty ( It is listed in"project "window under "vba project(personal.xlsb) module 1 under modules ) (there is no code


    in the module) can I safely delete this module? are their any other implications)
    4. The library module that i want to store in personal is module 3 in personal.xlsb. Can i rename this to "library" ( or any other name) ?
    Thank you for your input and suggestions

    Fred

    PS what is the "tags" window used for??

    fred

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    Access and excel are different. Access has objects called macros and access modules store subs and functions.
    excel has the modules that hold the subs too, but they are also 'macros'. Subs ARE the macros.

    in either, You can store all subs/functions in a single module.
    i create new modules to separate 'type' of code...
    1 module holds file I/O code,so it's named modFile
    1 module holds excel functions,named modXL
    Etc...
    this way I don't search ALL code in 1 module.

    You can tAke out the code in the personal file. The personal file is run by you alone,no matter what excel book is open.
    if you want the code to work for others, then it must Be
    in a module in the workbook,
    or in THEIR personal wb ,if the code is to work on all workbooks for them.

  3. #3
    ntambomvu is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Nov 2016
    Location
    Johannesburg south africa
    Posts
    91
    Ah Ha-- so that is how it works!!

    What if I have code that is common to all my worksheets-- for example

    I have code that protects and marks with a blue background any cell that has
    a formula
    Now I would like this to be common through all my worksheets - so that if
    I give a worksheet to someone else - then the same rule will apply even on
    another computer. so the other user will also have his formulae highlighted and
    protected?

  4. #4
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Welcome to the forum...

    You DO know this is an ACCESS forum and NOT an Excel forum... right???
    All of your questions seem to be about Excel...

    You might get better answers at:
    http://www.mrexcel.com/forum/
    or
    http://www.excelforum.com/

    Good luck...

  5. #5
    ntambomvu is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Nov 2016
    Location
    Johannesburg south africa
    Posts
    91
    thanks ssdanfu-
    I thought that modules were common to both programs- I will have to swot up a bit more about
    modules in access!!
    regards

    fred

  6. #6
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Access modules are contained in the Access file.
    Excel modules are contained in the Excel file.
    Both use VBA code.

    The "personal.xlsb" is similar to an addin library in Access. That is, you can have code common to multiple database available to use without putting the code in every dB.

    Macros (Scripting) in Access is a separate object than VBA code (Form Modules/Standard Modules)
    Macros in Excel used to be Scripting, but now, AFAIK, Macros in Excel means VBA code. I think macros (ie Scripting) from earlier versions like Excel97 will still run (backwards compatibility)

    I know you can use Access to execute code in Excel and in Access you can execute Excel functions if you set a reference to Excel.

    It was not clear to me how Access was involved in your question......

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 11
    Last Post: 11-18-2016, 06:43 AM
  2. Naming standards or conventions
    By Jennifer Murphy in forum Access
    Replies: 10
    Last Post: 02-01-2014, 08:04 PM
  3. Replies: 5
    Last Post: 05-08-2013, 05:36 PM
  4. Setting Naming Conventions for IDs
    By LukeJ Innov in forum Access
    Replies: 1
    Last Post: 04-25-2013, 06:27 AM
  5. Naming conventions
    By Yesideez in forum Database Design
    Replies: 3
    Last Post: 06-29-2011, 08:55 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums