+ Reply to Thread
Results 1 to 11 of 11

Create a new workbook

  1. #1
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Create a new workbook

    Why am I getting a run time error on the first sub?

    Please Login or Register  to view this content.
    *******************************************************

    HELP WANTED! (Links to Forum threads)
    Trying to create reusable code for Custom Events at Workbook (not Application) level

    *******************************************************

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Create a new workbook

    A Workbook is an element in the Workbooks collection. To create a new workbook within the collection requires using the .Add method. The New keyword doesn't add to the collection.
    Last edited by AlphaFrog; 11-22-2013 at 01:51 AM.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Re: Create a new workbook

    Please forgive my ignorance. I have two questions on your reply:
    1. Is it possible to create a new Excel file/WB without adding to a collection?
    2. When would you use New to create a new object?

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Create a new workbook

    create a new Excel file/WB without adding to a collection?
    Please Login or Register  to view this content.
    Entia non sunt multiplicanda sine necessitate

  5. #5
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Create a new workbook

    Where would the workbook exist if it wasn't a member of the Workbooks collection?
    If posting code please use code tags, see here.

  6. #6
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Re: Create a new workbook

    Quote Originally Posted by shg View Post
    Please Login or Register  to view this content.
    I get a run-time error 53 File not found?

  7. #7
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Re: Create a new workbook

    Quote Originally Posted by Norie View Post
    Where would the workbook exist if it wasn't a member of the Workbooks collection?
    Of course. That was a stupid question of mine wasn't it?

  8. #8
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Create a new workbook

    Quote Originally Posted by mc84excel View Post
    I get a run-time error 53 File not found?
    Please Login or Register  to view this content.
    You should install Help on your computer.

  9. #9
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Re: Create a new workbook

    Quote Originally Posted by shg View Post
    Please Login or Register  to view this content.
    You should install Help on your computer.
    That would create a new workbook as a copy of an existing workbook no? (I was after creating a new blank workbook).

  10. #10
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Create a new workbook

    Then create someexistingfile.xlsx as an empty workbook.

    It is surely possible to duplicate Window's ability to create a new .xxx document in a folder. If I learned how, I would make no attempt to remember it or write it down.

  11. #11
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Re: Create a new workbook

    Quote Originally Posted by shg View Post
    It is surely possible to duplicate Window's ability to create a new .xxx document in a folder.
    I agree.

    Quote Originally Posted by shg View Post
    If I learned how, I would make no attempt to remember it or write it down.
    Same here. I'm sticking to Workbooks.Add.

+ 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. [SOLVED] Create new workbook + create link to that new workbook
    By remymorthier in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 09-14-2013, 02:44 PM
  2. Vba cmd1 create workbook cmd2 create worksheet depend upon combobox values
    By breadwinner in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-17-2013, 03:20 AM
  3. [SOLVED] Macro to Use Multiple Cells in Workbook to Create Code Cell in another Workbook
    By michaelpair in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 06-26-2013, 10:33 AM
  4. [SOLVED] copy active sheet, create new workbook, name new workbook based on cell reference
    By jm0392 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-20-2012, 07:12 PM
  5. Replies: 3
    Last Post: 04-11-2012, 09:07 PM

Tags for this Thread

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