+ Reply to Thread
Results 1 to 3 of 3

Import Code Module

  1. #1
    Registered User
    Join Date
    12-04-2006
    Posts
    10

    Import Code Module

    I d/l date from the main system into Excel. Do some slice and dicing and then create a series of new worksheets. Into each of these new sheets I also need to include some macro code. So based on examples I found on the board here I tried.
    Please Login or Register  to view this content.

    Where the text file "Importcode.txt" contains the macro code and fn is the name of the worksheet that was just created and closed.

    The error I get is "subscript out of range" in the blue statement above.

    I want to use the import because the macro could be different at various locations. The separate file will make maintenance easier.

    Thanks
    Last edited by VBA Noob; 03-16-2007 at 06:04 PM.

  2. #2
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208
    I may be off here, but per the VBA help for the Workbooks collection:

    "Returns a Workbooks collection that represents all the open workbooks."

    So you may need to open the workbook, import the module, then close, saving changes:
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    08-22-2011
    Location
    Berlin
    MS-Off Ver
    Excel 2010
    Posts
    51

    Re: Import Code Module

    I would recommend to have a look at Multiple Code Management. I myself fiddled with this subject for very long before I got fed up and implemented a proper solution for this job.
    Last edited by Warbe; 11-14-2015 at 05:55 PM.

+ 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