+ Reply to Thread
Results 1 to 10 of 10

How to create new workbook when opening other workbook

  1. #1
    Registered User
    Join Date
    11-25-2014
    Location
    Michigan
    MS-Off Ver
    2003
    Posts
    15

    How to create new workbook when opening other workbook

    I am trying to get a workbook to create a new workbook with the name week-(year)-(month)-(day) and then show that workbook.

    Example
    When I open the book " msl workbook" I want it to create a new book with the name "week-(year)-(month)-(day)" and make the new book active.
    I am using excell 2003. The year, month and day would be the current date of use.
    Is this possible.

    Thanks for any help.

    Lloyd
    Last edited by 6StringJazzer; 09-16-2018 at 09:43 AM. Reason: Moved from Excel - New Users/Basics, requires VBA

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: How to create new workbook when opening other workbook

    This requires macros. Put the following code in the ThisWorkbook module of "msl workbook.xlsx" and save it as a .xlsm file.

    I could interpret your file name description in more than one way. Give an example of what you want your file name to look like. Do you mean this:

    week-2018-09-16.xlsx

    The code will look like this:
    Please Login or Register  to view this content.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,481

    Re: How to create new workbook when opening other workbook

    You can use your macro recorder to add a workbook and save it, once you have a code to work with, you can ask how to save it as a date format.

  4. #4
    Registered User
    Join Date
    11-25-2014
    Location
    Michigan
    MS-Off Ver
    2003
    Posts
    15

    Re: How to create new workbook when opening other workbook

    I have a button the the form to create the new form, the problem is when someone else uses the program they forget to create the new form.
    So I am trying to eliminate the need for them to press the button.

    Hope I have explained this correctly.

    I could not get StringJazzers answer to work.

    Lloyd

  5. #5
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: How to create new workbook when opening other workbook

    Quote Originally Posted by lloyd frank View Post
    I could not get StringJazzers answer to work.
    I would be happy to help, but I tested it before I gave it to you and it worked fine for me. I'll test it with your file if you attach it.

    Also note that I requested an example of what file name you want.

    Please explain what "doesn't work" means.
    • Does the code run?
    • Does it run but do nothing?
    • Does it produce error messages? If so, what do the messages say?
    • Does it produce unexpected/wrong results? If so, how do the results differ from what you expect?
    • Does it hang?

  6. #6
    Registered User
    Join Date
    11-25-2014
    Location
    Michigan
    MS-Off Ver
    2003
    Posts
    15

    Re: How to create new workbook when opening other workbook

    I think I have attached the file. It has been many years since I have been on the forum.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    11-25-2014
    Location
    Michigan
    MS-Off Ver
    2003
    Posts
    15

    Re: How to create new workbook when opening other workbook

    The file name should be "week-2018-09-17" or the day the file is opened. this is only used once a week.

  8. #8
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: How to create new workbook when opening other workbook

    You have the code in the wrong place. You put it in Module6.

    Quote Originally Posted by 6StringJazzer View Post
    Put the following code in the ThisWorkbook module

  9. #9
    Registered User
    Join Date
    11-25-2014
    Location
    Michigan
    MS-Off Ver
    2003
    Posts
    15

    Re: How to create new workbook when opening other workbook

    Thanks everyone. That did it. (Don't see where to mark it solved)
    Last edited by lloyd frank; 09-17-2018 at 04:55 PM.

  10. #10
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: How to create new workbook when opening other workbook

    Go to the menu immediately above your first post to the thread and click on Thread Tools. From the dropdown menu select "Mark this thread as solved..."

    If a member helped you solve your problem, consider adding to their reputation by clicking on the star icon below their name.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 1
    Last Post: 06-22-2018, 08:16 PM
  2. Create backup via VBA when opening Excel workbook
    By mechengr02 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 10-17-2014, 01:31 PM
  3. [SOLVED] Opening new workbook and pasting values into current workbook - code issues
    By Stew1234 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-15-2014, 07:56 AM
  4. how to create copy of a workbook without opening it
    By amethystfeb in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-23-2014, 11:23 PM
  5. Copy data one workbook to another workbook without opening workbook
    By HaroonSid in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-04-2014, 11:28 AM
  6. [SOLVED] Create MSG Box upon opening a workbook
    By timmyjc18 in forum Excel General
    Replies: 10
    Last Post: 06-19-2012, 06:05 AM
  7. How to Create User form which appears upon opening workbook?
    By MacMasta in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-04-2012, 12:55 PM

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