+ Reply to Thread
Results 1 to 4 of 4

How do I copy macro into new workbook that was created automatica.

Hybrid View

  1. #1
    Darshan
    Guest

    How do I copy macro into new workbook that was created automatica.

    I am creating a new workbook with a macro. I want the macro to be copied to
    the new workbook too automatically so I can run that macro again from the new
    workbook.

  2. #2
    Tom Ogilvy
    Guest

    Re: How do I copy macro into new workbook that was created automatica.

    Look at Chip Pearson's page on working with the VBE with code
    http://www.cpearson.com/excel/vbe.htm

    --
    Regards,
    Tom Ogilvy

    "Darshan" <Darshan@discussions.microsoft.com> wrote in message
    news:AF1B8F44-FEB5-41F4-BF8C-6E64E4DE4BC0@microsoft.com...
    > I am creating a new workbook with a macro. I want the macro to be copied

    to
    > the new workbook too automatically so I can run that macro again from the

    new
    > workbook.




  3. #3
    CodeSponge
    Guest

    Re: How do I copy macro into new workbook that was created automatica.

    Here how I do it with one of my projects.


    With Workbooks("PERSONAL.XLS").VBProject
    ..VBComponents("FollowUpSupport").Export
    ("h:\Macros\FollowUpSupport.bas")
    ..VBComponents("ProjectSupport").Export
    ("h:\Macros\ProjectSupport.bas")
    ..VBComponents("PSSupport").Export ("h:\Macros\PSSupport.bas")
    ..VBComponents("PSLogin").Export ("h:\Macros\PSLogin.frm")
    End With

    With neoBook
    ..VBProject.VBComponents.Import "h:\Macros\FollowUpSupport.bas"
    ..VBProject.VBComponents.Import "h:\Macros\ProjectSupport.bas"
    ..VBProject.VBComponents.Import "h:\Macros\PSSupport.bas"
    ..VBProject.VBComponents.Import "h:\Macros\PSLogin.frm"
    ..VBProject.References.AddFromFile
    "C:\WINDOWS\system32\vbscript.dll\3"
    ..VBProject.References.AddFromFile
    "C:\WINDOWS\system32\shdocvw.dll"

    ..SaveAs "H:\EXCEL\FollowUpList.xls", xlWorkbookNormal
    End With
    End Sub


  4. #4
    Dave Peterson
    Guest

    Re: How do I copy macro into new workbook that was created automatica.

    Another option would be just to leave the code in its own workbook.

    Then have that "macro workbook" open whenever you need to run the macro.

    (I've found that it's easier to make a change in one workbook, than to find all
    the workbooks and update all those.)

    Darshan wrote:
    >
    > I am creating a new workbook with a macro. I want the macro to be copied to
    > the new workbook too automatically so I can run that macro again from the new
    > workbook.


    --

    Dave Peterson

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1