PLEASE CAN ANY BODY HELP

K

K

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.
 
L

Larry

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top