Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
PLEASE CAN ANY BODY HELP
Hi all, I have macro in normal module (see below) and file in which
I have this macro is protected by password and is "ReadOnly" so no one can modify anything. Macro: =================================== Sub SF() Dim FileNameSave As Variant MsgBox "Please first SaveAs the file", vbInformation, "Save As First" FileNameSave = Application.GetSaveAsFilename( _ InitialFileName:="C:\ENTER FILE NAME", fileFilter:="Excel Macro- Enabled Workbook(*.xlsm),*.xlsm,") If FileNameSave = False Then MsgBox "You Must SaveAs the File before sending for Authorisation", vbCritical, "ERROR" Else ThisWorkbook.SaveAs Filename:=FileNameSave, CreateBackup:=False End If End Sub <==================================== I call this macro from ThisWorkbook Module which is Private Sub Workbook_Open() Call SF End Sub the macro above prompt the user to SaveAs the file when the user open the file. I want some sort of code or someone to tell me that how can I remove or delete just "Call SF" line from ThisWorkbook Module and above macro which is "Sub SF()" and it is in Module 6 from the file which will be SaveAs by user. Obvisally i dont want everything to be deleted from the orginal file althought it cant be because file is read only but i want thing to be deleted or removed which i mentioned above from the new SavedAs file. I want this because i dont want that when user open the SavedAs file he should still get messages that to "Save the file as SaveAs". Please can any friend help me. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
PLEASE CAN ANY BODY HELP
Create an If statement before you make the call statement. If
activeworkbook.name = the original workbook name, call the saveas, else go to the next step. -- Larry "K" wrote: Hi all, I have macro in normal module (see below) and file in which I have this macro is protected by password and is "ReadOnly" so no one can modify anything. Macro: =================================== Sub SF() Dim FileNameSave As Variant MsgBox "Please first SaveAs the file", vbInformation, "Save As First" FileNameSave = Application.GetSaveAsFilename( _ InitialFileName:="C:\ENTER FILE NAME", fileFilter:="Excel Macro- Enabled Workbook(*.xlsm),*.xlsm,") If FileNameSave = False Then MsgBox "You Must SaveAs the File before sending for Authorisation", vbCritical, "ERROR" Else ThisWorkbook.SaveAs Filename:=FileNameSave, CreateBackup:=False End If End Sub <==================================== I call this macro from ThisWorkbook Module which is Private Sub Workbook_Open() Call SF End Sub the macro above prompt the user to SaveAs the file when the user open the file. I want some sort of code or someone to tell me that how can I remove or delete just "Call SF" line from ThisWorkbook Module and above macro which is "Sub SF()" and it is in Module 6 from the file which will be SaveAs by user. Obvisally i dont want everything to be deleted from the orginal file althought it cant be because file is read only but i want thing to be deleted or removed which i mentioned above from the new SavedAs file. I want this because i dont want that when user open the SavedAs file he should still get messages that to "Save the file as SaveAs". Please can any friend help me. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
PLEASE CAN ANY BODY HELP | Excel Programming | |||
Please any body help me.i need help as soon as possible | Excel Discussion (Misc queries) | |||
Any body help me out with this? | Excel Discussion (Misc queries) | |||
can some body help me | Excel Programming | |||
Can any body help? | Excel Programming |