+ Reply to Thread
Results 1 to 9 of 9

Excel vba code disappears from Thisworkbook when save as workbook is reopened

  1. #1
    Registered User
    Join Date
    12-12-2013
    Location
    Sudbury
    MS-Off Ver
    Excel 2010
    Posts
    66

    Excel vba code disappears from Thisworkbook when save as workbook is reopened

    Hello All,

    I need help in solving an interesting problem I am facing.
    I have a VB program (in Module 1) that saves file in excel & pdf format once click a button Submit.
    But when I open my saved excel file I couldn't find my VB code in Thisworkbook (Code that I need for another task). In short my VB code disapears from Thisworkbook....

    I appreciate if you help me out.

    Thanks

  2. #2
    Registered User
    Join Date
    12-12-2013
    Location
    Sudbury
    MS-Off Ver
    Excel 2010
    Posts
    66

    Re: Excel vba code disappears from Thisworkbook when save as workbook is reopened

    Here I would like to mention that VB code exist in Thisworkbook of original file but disappears in Thiswoorkbook of save as file.

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

    Re: Excel vba code disappears from Thisworkbook when save as workbook is reopened

    Can you post the save as code?
    If posting code please use code tags, see here.

  4. #4
    Registered User
    Join Date
    12-12-2013
    Location
    Sudbury
    MS-Off Ver
    Excel 2010
    Posts
    66

    Re: Excel vba code disappears from Thisworkbook when save as workbook is reopened

    Sure! Thanks ...Please find below:

    Please Login or Register  to view this content.

  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: Excel vba code disappears from Thisworkbook when save as workbook is reopened

    Do you mean to have this in the code?
    Please Login or Register  to view this content.
    That's deleting all the code in the ThisWorkbook module of the active workbook, which is more than likely the workbook the code is 'disappearing' from.

    How do things work out if your remove that part of the code?

  6. #6
    Registered User
    Join Date
    12-12-2013
    Location
    Sudbury
    MS-Off Ver
    Excel 2010
    Posts
    66

    Re: Excel vba code disappears from Thisworkbook when save as workbook is reopened

    Thanks!

    Let me check....

  7. #7
    Registered User
    Join Date
    12-12-2013
    Location
    Sudbury
    MS-Off Ver
    Excel 2010
    Posts
    66

    Re: Excel vba code disappears from Thisworkbook when save as workbook is reopened

    Wow Thanks! you are right

  8. #8
    Registered User
    Join Date
    12-12-2013
    Location
    Sudbury
    MS-Off Ver
    Excel 2010
    Posts
    66

    Re: Excel vba code disappears from Thisworkbook when save as workbook is reopened

    Thanks Norie! You solved my problem

  9. #9
    Registered User
    Join Date
    12-12-2013
    Location
    Sudbury
    MS-Off Ver
    Excel 2010
    Posts
    66

    Re: Excel vba code disappears from Thisworkbook when save as workbook is reopened

    It solved one thin but got another problem.

    The code you suggested to delete has some purpose. it deletes the code from Thisworkbook once submitted so the saved as file should have all data. If not deleted then it clear the data from save as excel file (form).

+ 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: 5
    Last Post: 09-13-2013, 12:03 AM
  2. Replies: 3
    Last Post: 05-14-2013, 08:53 AM
  3. Replies: 11
    Last Post: 05-15-2012, 01:22 PM
  4. VBA to save a worksheet with ComboBoxes and not allow it to be edited when reopened
    By menmine5 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-11-2012, 02:19 PM
  5. Excel 2002 Delete Thisworkbook code Not Working.
    By realniceguy5000 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-20-2011, 08:49 AM
  6. Remove all code from workbook except "Thisworkbook"
    By realniceguy5000 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-13-2010, 07:34 PM
  7. Copy Thisworkbook code into a new workbook
    By akabraha in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-25-2009, 03:17 PM
  8. Excel vba code disappears when saved workbook is re opened
    By Joshua Fandango in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-05-2005, 12:06 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