Results 1 to 4 of 4
  1. #1
    trevor40's Avatar
    trevor40 is offline Advanced db Manager
    Windows XP Access 2003
    Join Date
    Feb 2014
    Location
    Australia
    Posts
    402

    create excel module/macro with access vba


    Hi, just curious if it's possible to create an excel module/macro by using access vba to make the module/macro and then put it into an excel sheet, and then run the macro.
    or do i have to have a saved excel sheet with the macro already in it, open that file and import the macro from there?

  2. #2
    drexasaurus's Avatar
    drexasaurus is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2011
    Location
    Santa Ana, CA
    Posts
    60
    It is complicated. It's technically possible to add code to a module using vba, here is an example I favorited a while ago: http://www.cpearson.com/excel/vbe.aspx

    What you might want to do is export the module you want to use as a file, and then import it into your projects when needed with code, rather than using an excel file with the module already in it. That is something that is easier than up above, and possibly more flexible that using a template like you suggested; I've done it with Access databases, and I assume it would work as well for excel.

  3. #3
    trevor40's Avatar
    trevor40 is offline Advanced db Manager
    Windows XP Access 2003
    Join Date
    Feb 2014
    Location
    Australia
    Posts
    402

    Excelent, it can be done

    Quote Originally Posted by drexasaurus View Post
    It is complicated. It's technically possible to add code to a module using vba, here is an example I favorited a while ago: http://www.cpearson.com/excel/vbe.aspx

    What you might want to do is export the module you want to use as a file, and then import it into your projects when needed with code, rather than using an excel file with the module already in it. That is something that is easier than up above, and possibly more flexible that using a template like you suggested; I've done it with Access databases, and I assume it would work as well for excel.

    thanks for looking at this, now I can create a macro using access to create a macro for excel and run it. All from Access.

  4. #4
    trevor40's Avatar
    trevor40 is offline Advanced db Manager
    Windows XP Access 2003
    Join Date
    Feb 2014
    Location
    Australia
    Posts
    402
    Quote Originally Posted by trevor40 View Post
    thanks for looking at this, now I can create a macro using access to create a macro for excel and run it. All from Access.

    finnaly got around to doing it, and the results are great.
    adding -
    macros, modules, worksheet.update code as well.

    BUT if you change your sheet names it may cause problems as the code to place the procedures uses the worksheet.codename and this doesnt cnange with the worksheet name.

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

Similar Threads

  1. Replies: 3
    Last Post: 12-02-2014, 09:38 AM
  2. Replies: 1
    Last Post: 10-01-2014, 06:21 AM
  3. Replies: 4
    Last Post: 03-13-2013, 08:57 PM
  4. Replies: 1
    Last Post: 04-30-2012, 05:10 PM
  5. Converting Excel Macro into Access Module
    By diddyville in forum Modules
    Replies: 1
    Last Post: 03-28-2011, 07:02 PM

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