+ Reply to Thread
Results 1 to 4 of 4

Copying VBA held in 'ThisWorkbook' to a new workbook

  1. #1
    Registered User
    Join Date
    07-29-2011
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    11

    Copying VBA held in 'ThisWorkbook' to a new workbook

    Hi,
    I have an interesting one:
    - i am creating new workbooks from a master workbook and when i do this i need to also find a way of copying the VBA scripts which are held in 'This WorkBook' section, as it holds Workbook Open () events.

    Has anybody done this?

    any help would be great,
    goodwin

  2. #2
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: Copying VBA held in 'ThisWorkbook' to a new workbook

    Create a template workbook with the VBA code, and use that.

    Copying a workbook with VBA will copy that VBA.

  3. #3
    Registered User
    Join Date
    07-29-2011
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Copying VBA held in 'ThisWorkbook' to a new workbook

    Hi thanks for the update.
    I would create a template workbook but each child workbook that i create is slightly different, name etc..
    Thats why i need to copy the vba within Open WorkBook() as park of the workbook creation process.

    Rgds

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Copying VBA held in 'ThisWorkbook' to a new workbook

    Bob is right.. A proper template requires a name change.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

+ 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