Fonty
Jun 16th, 2006, 06:22 AM
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:
Private Sub cmdSave_Click()
Dim Dest As Workbook
file= ThisWorkbook.Path & "\" & txtFile.Value & ".xls"
Worksheets("Report").Copy
Set Dest = ActiveWorkbook
Dest.SaveAs file
' Here the Shape and the text box which where grouped are deleted, so that
' you only see the report
ActiveSheet.Shapes("Group 1").Select
Selection.Delete
ActiveSheet.Range("A1").Select
ActiveWorkbook.Save
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?
Private Sub cmdSave_Click()
Dim Dest As Workbook
file= ThisWorkbook.Path & "\" & txtFile.Value & ".xls"
Worksheets("Report").Copy
Set Dest = ActiveWorkbook
Dest.SaveAs file
' Here the Shape and the text box which where grouped are deleted, so that
' you only see the report
ActiveSheet.Shapes("Group 1").Select
Selection.Delete
ActiveSheet.Range("A1").Select
ActiveWorkbook.Save
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?