Consulting

Results 1 to 5 of 5

Thread: Saving after autodeleting

  1. #1
    VBAX Contributor
    Joined
    Aug 2006
    Posts
    120
    Location

    Saving after autodeleting

    Hi, I have a program that i would like to auto-destruct after a specific period of time.

    [VBA]
    With ThisWorkbook.VBProject.VBComponents("Module1").CodeModule
    .DeleteLines 1, .CountOfLines
    End With
    With ThisWorkbook.VBProject.VBComponents("UserForm").CodeModule
    .DeleteLines 1, .CountOfLines
    End With
    Application.Workbooks("MyMacro").Save
    [/VBA]

    After running it the code is deleted but the workbook does not autosave, thanks

  2. #2
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    try something like this:
    [VBA] ActiveWorkbook.Save[/VBA]
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  3. #3
    VBAX Contributor
    Joined
    Aug 2006
    Posts
    120
    Location
    sorry, i forgot to say im working through an addin. by saying activeworkbook.save the current workbook will be saved instead of the addin

  4. #4
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    so you want to delete code from the addin???
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  5. #5
    VBAX Contributor
    Joined
    Aug 2006
    Posts
    120
    Location
    yes

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •