Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 141
Default Prevent copy of filename

Hi,

I am looking for a Macro to run so that users cant save as or create a copy
of a file in excel, I only want the user to use the save icon or when you
press the red cross for a popup to appear saying only save new changes in an
excel workbook.

The people using this workbook are creating copies by accident and so are
working from different files all the time, they dont know how to disable
macros and they dont have reason to I am looking for this code to prevent
creating copies of filename.

Can anyone please help me with this.

Many thanks

Terilad

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 102
Default Prevent copy of filename

Look at the BeforeSave event.
You could use something like this:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
Cancel = True
If Not SaveAsUI Then
Cancel = False
MsgBox "Saved normally."
Else
MsgBox "You tried to do a Save as ... naughty boy!", vbCritical, "File Not
Saved!"
End If
End Sub

Of course the message box is mainly for testing, edit it accordingly.
Place the code into the ThisWorkbook code module, not a normal module.

This wont stop determined users, who may copy individual worksheets to new
or existing workbooks. Or may use code like, Sheets.Copy. Not sure how one
could stop that. :)


Regards
Robert McCurdy

"terilad" wrote in message
...
Hi,

I am looking for a Macro to run so that users cant save as or create a
copy
of a file in excel, I only want the user to use the save icon or when you
press the red cross for a popup to appear saying only save new changes in
an
excel workbook.

The people using this workbook are creating copies by accident and so are
working from different files all the time, they dont know how to disable
macros and they dont have reason to I am looking for this code to prevent
creating copies of filename.

Can anyone please help me with this.

Many thanks

Terilad



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 141
Default Prevent copy of filename

Hi, I have tried the code but cant seem to get it to operate, compile errors
etc, I copied the code from here and paste, possibly the reason, how should
the code look in VBA so it can operate?

Regards and thanks.

Terilad

"Robert McCurdy" wrote:

Look at the BeforeSave event.
You could use something like this:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
Cancel = True
If Not SaveAsUI Then
Cancel = False
MsgBox "Saved normally."
Else
MsgBox "You tried to do a Save as ... naughty boy!", vbCritical, "File Not
Saved!"
End If
End Sub

Of course the message box is mainly for testing, edit it accordingly.
Place the code into the ThisWorkbook code module, not a normal module.

This wont stop determined users, who may copy individual worksheets to new
or existing workbooks. Or may use code like, Sheets.Copy. Not sure how one
could stop that. :)


Regards
Robert McCurdy

"terilad" wrote in message
...
Hi,

I am looking for a Macro to run so that users cant save as or create a
copy
of a file in excel, I only want the user to use the save icon or when you
press the red cross for a popup to appear saying only save new changes in
an
excel workbook.

The people using this workbook are creating copies by accident and so are
working from different files all the time, they dont know how to disable
macros and they dont have reason to I am looking for this code to prevent
creating copies of filename.

Can anyone please help me with this.

Many thanks

Terilad




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 141
Default Prevent copy of filename

Ok I fixed it,

Many thanks for your help.

Terilad

"Robert McCurdy" wrote:

Look at the BeforeSave event.
You could use something like this:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
Cancel = True
If Not SaveAsUI Then
Cancel = False
MsgBox "Saved normally."
Else
MsgBox "You tried to do a Save as ... naughty boy!", vbCritical, "File Not
Saved!"
End If
End Sub

Of course the message box is mainly for testing, edit it accordingly.
Place the code into the ThisWorkbook code module, not a normal module.

This wont stop determined users, who may copy individual worksheets to new
or existing workbooks. Or may use code like, Sheets.Copy. Not sure how one
could stop that. :)


Regards
Robert McCurdy

"terilad" wrote in message
...
Hi,

I am looking for a Macro to run so that users cant save as or create a
copy
of a file in excel, I only want the user to use the save icon or when you
press the red cross for a popup to appear saying only save new changes in
an
excel workbook.

The people using this workbook are creating copies by accident and so are
working from different files all the time, they dont know how to disable
macros and they dont have reason to I am looking for this code to prevent
creating copies of filename.

Can anyone please help me with this.

Many thanks

Terilad




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Prevent Copy action Q Sean Excel Programming 1 January 26th 08 03:34 PM
Prevent Excel putting full filename in external links on update [email protected] Excel Discussion (Misc queries) 5 March 29th 07 08:42 PM
copy formulaes w/o filename jmwismer Excel Discussion (Misc queries) 3 December 20th 05 07:25 AM
EXCEL FILE a copy/a copy/a copy ....filename ve New Users to Excel 1 September 29th 05 09:12 PM
Date + Filename using save copy as SKelley Excel Programming 4 April 27th 05 09:30 PM


All times are GMT +1. The time now is 06:09 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"