|
-
Jun 16th, 2006, 06:22 AM
#1
Thread Starter
Addicted Member
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:
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?
Last edited by Fonty; Jun 19th, 2006 at 11:38 AM.
-
Jun 16th, 2006, 09:15 AM
#2
Re: Deleting Vba code - Urgent
Can't you create a new workbook and sheet, and put the report in there?
Feeling like a fly on the inside of a closed window (Thunk!)
If I post a lot, it is because I am bored at work! ;D Or stuck...
* Anything I post can be only my opinion. Advice etc is up to you to persue...
-
Jun 16th, 2006, 10:55 AM
#3
Re: Deleting Vba code - Urgent
If you have VBA code behind the sheet object then that will get copied over too. You will need to copy the range on your sheet and paste it into the new blank sheet.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|