Results 1 to 3 of 3

Thread: RESOLVED[Deleting Vba code - Urgent]

Threaded View

  1. #1

    Thread Starter
    Addicted Member Fonty's Avatar
    Join Date
    May 2006
    Location
    New York
    Posts
    173

    Exclamation RESOLVED[Deleting Vba code - Urgent]

    I have a user form which gives you in the end a report of the data you filled. This report is printed in a worksheet called Report. In this worksheet the is at the bottom a text box grouped with some image in a shape as backgroud. In this text box you enter the name of the report, and then, after a click on Save button you get the following code:

    VB Code:
    1. Private Sub cmdSave_Click()
    2.  
    3. Dim Dest As Workbook
    4.  
    5.     file= ThisWorkbook.Path & "\" & txtFile.Value & ".xls"
    6.     Worksheets("Report").Copy
    7.     Set Dest = ActiveWorkbook
    8.     Dest.SaveAs file
    9. ' Here the Shape and the text box which where grouped are deleted, so that
    10. ' you only see the report
    11.     ActiveSheet.Shapes("Group 1").Select
    12.     Selection.Delete
    13.     ActiveSheet.Range("A1").Select
    14.     ActiveWorkbook.Save
    15.    
    16. End Sub

    It works just fine. However, my question is, is it possible that once it is saved in the new location, the Vba code gets deleted, in order to have only an Excel sheet which will not ask you every time about the macro security?
    Last edited by Fonty; Jun 19th, 2006 at 11:38 AM.

Posting Permissions

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



Click Here to Expand Forum to Full Width