Vinu,

I think the following statement may work for you

*ActiveWorkbook.SaveAs Filename:="PAth of the file", _
        FileFormat:=xlNormal, Password:="A", WriteResPassword:="A", _
        ReadOnlyRecommended:=False, CreateBackup:=False
*
Group: Guys i think i am not pretty sure about this code, as this code may
throw up errors, if run again. Please suggest an alternate solution

Harry

On Mon, Apr 26, 2010 at 12:57 PM, Vinu <vinu1sm...@gmail.com> wrote:

> Hi Harry,
>
> Thanks a lot, its working correctly as I expected.
>
> Now I need one more statement to add to this code. ie., before closing
> workbook, it shd be protect the workbook  by giving password"a" and save it
> in desktop.  So no one can access this without having password.
>
>
> how do I attach this statemetn pls let me know.
>
> once again thanks a lot..!!
>
> Regards,
> vinu.
>
>   On 26 April 2010 07:22, Harpreet Singh Gujral 
> <harpreetguj...@gmail.com>wrote:
>
>> Hi vinu,
>>
>> A small correction on the Workbook open event macro:
>>
>>  Private Sub Workbook_Open()
>>  'Advise the user the workbook will close if inactive for 10 seconds.
>> 'To adjust the time, such as if you want to allow 1 hour and 15 minutes,
>> 'change this line
>> Application.OnTime Now + TimeSerial(0, 45, 0), "CloseMewarning"
>>
>> Application.OnTime Now + TimeSerial(0, 60, 0), "CloseMe"
>> 'and remember to update the message box.
>> MsgBox "This workbook will close itself after 10 seconds.", 48, "FYI..."
>> Application.OnTime Now + TimeSerial(0, 0, 10), "CloseMe"
>> End Sub
>>
>>
>>   ---------- Forwarded message ----------
>> From: Harpreet Singh Gujral <harpreetguj...@gmail.com>
>> Date: Sat, Apr 24, 2010 at 10:27 PM
>> Subject: Need help to complete a Excel Model.. Options
>> To: excel-macros@googlegroups.com
>> Cc: vinu1sm...@gmail.com
>>
>>
>> Hi Vinu,
>>
>> I looked at the link provided by you.
>>
>> I have attached a workbook with this email, i hope this resolves your
>> problem. I have used the following code:
>>
>> Private Sub Workbook_Open()
>> 'Advise the user the workbook will close if inactive for 10 seconds.
>> 'To adjust the time, such as if you want to allow 1 hour and 15 minutes,
>> 'change this line
>> Application.OnTime Now + TimeSerial(0, 45, 0), "CloseMe"
>> Application.OnTime Now + TimeSerial(0, 60, 0), "CloseMe"
>> 'and remember to update the message box.
>> MsgBox "This workbook will close itself after 10 seconds.", 48, "FYI..."
>> Application.OnTime Now + TimeSerial(0, 0, 10), "CloseMe"
>> End Sub
>>
>> This code will fire a ontime macro, which will run as follows:
>>
>> 1) After 45 mins, user will get a warning message that the sheet will
>> close after 15 mins
>>
>> 2) After 60 mins, the sheet will close
>>
>> The following code needs to be placed in the Module:
>>
>> Private Sub CloseMeWarning()
>> MsgBox "45 mins have elapsed, you have 15mins left on the exam!",
>> vbCritical + vbOKOnly
>> End Sub
>>
>> End Sub
>>
>> Private Sub CloseMe()
>> ThisWorkbook.Close True
>> End Sub
>>
>> End Sub
>>
>>
>> Cheers!
>>
>> Harry
>>
>>
>>
>
>
> --
> Regards
>
> Vinod Kumar
> Bangalore
>
>
>

-- 
----------------------------------------------------------------------------------
Some important links for excel users:
1. Follow us on TWITTER for tips tricks and links : 
http://twitter.com/exceldailytip
2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
3. Excel tutorials at http://www.excel-macros.blogspot.com
4. Learn VBA Macros at http://www.quickvba.blogspot.com
5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 
To post to this group, send email to excel-macros@googlegroups.com

<><><><><><><><><><><><><><><><><><><><><><>
HELP US GROW !!

We reach over 6,800 subscribers worldwide and receive many nice notes about the 
learning and support from the group.Let friends and co-workers know they can 
subscribe to group at http://groups.google.com/group/excel-macros/subscribe

Reply via email to