+ Reply to Thread
Results 1 to 7 of 7

Renaming Workbook Module

  1. #1
    Forum Contributor
    Join Date
    08-20-2012
    Location
    Walsall,England
    MS-Off Ver
    Excel 2007
    Posts
    125

    Renaming Workbook Module

    Hi,

    I am trying to rename the workbook module from ThisWorkbook to something else through the properties window. I can change the name fine, but when I close the file and reopen it the workbook module name has reverted back to ThisWorkbook. Any ideas?

    Thanks

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481

    Re: Renaming Workbook Module

    Thisworkbook is a built in reference to the workbook and should not be renamed.

    Why do you want to rename it?
    Cheers
    Andy
    www.andypope.info

  3. #3
    Forum Contributor
    Join Date
    08-20-2012
    Location
    Walsall,England
    MS-Off Ver
    Excel 2007
    Posts
    125

    Re: Renaming Workbook Module

    I'm just trying to organise the modules. I was under the impression that using the ThisWorkbook reference worked regardless of what the name of the actual workbook module was. Are you saying that changing the name of the workbook module would cause the ThisWorkbook reference not to work? Also, why are you allowed to change the name of the workbook module in the properties window just for it to change back after the file has been closed and reopened?

    Thanks for the response

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481

    Re: Renaming Workbook Module

    Okay, maybe 'should not be renamed' is too strong. I would advise against renaming.

    I just did a test and was able to give it a new name that remained after saving and re-opening.
    I was also able to reference it via it's new name, andysbook,

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    08-20-2012
    Location
    Walsall,England
    MS-Off Ver
    Excel 2007
    Posts
    125

    Re: Renaming Workbook Module

    I've just tried renaming it again and it has worked fine - very strange! Why would you advise against renaming it?

    Thanks

  6. #6
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481

    Re: Renaming Workbook Module

    It's the 1 reference in a workbook's VBA project that most coders would normally recognise simply by it's name.

    Renaming userforms, modules, classes and sheet code names is fine.
    Do you use the Folder view in the Project window to group those items?

  7. #7
    Forum Contributor
    Join Date
    08-20-2012
    Location
    Walsall,England
    MS-Off Ver
    Excel 2007
    Posts
    125

    Re: Renaming Workbook Module

    OK, I'll keep the workbook module's name the same. Yes I use the folder view, it's a bit of a mess without it!

    Thanks for your advice.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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