Programming

Programming questions? Ask a programmer for answers ASAP

Ask a Computer Expert,
Get an Answer ASAP!

Hi, I want to prevent people from moving copying a file to…

Customer Question
Hi, I want to prevent...
Hi, I want to prevent people from moving\copying a excel spreadsheet file to a different file directory. Is it possible to create a macro to close the file when opening, if the opening file directory location does not match the default setting.
Submitted: 8 years ago.Category: Programming
Show More
Show Less
Ask Your Own Programming Question
Answered in 4 hours by:
6/14/2010
Programmer: Arty, Computer Software Engineer replied 8 years ago
Arty
Arty, Computer Software Engineer
Category: Programming
Satisfied Customers: 575
Experience: 15+ years of programming, C, C++, Java, PHP, awk, ruby, shell, ASM, Forth, Raptor, M.A.R.I.E, Excel
Verified

> Is it possible to create a macro to close the file when opening, if the opening file directory location does not match the default setting.

 

That's impossible. Users can disabe macro while opening file, they can just copy-paste the file in explorer without opening it.

 

Sure you may wait for other experts replies, but as far as I know you can't prevent them from copying file to the different location.

 

Regards,

Arty



Edited by Arty on 6/14/2010 at 1:36 PM EST
Ask Your Own Programming Question
Programmer: Jim Clark, Software Developer replied 8 years ago
Jim Clark
Jim Clark, Software Developer
Category: Programming
Satisfied Customers: 422
Experience: 25 years of programming experience. 15 years in web development.
Verified
Hi!

Yes and no. If you are trying to ensure that the spreadsheet is located where other resources are available, then yes. You can prevent the spreadsheet from functioning if it is located somewhere other than the default directory.

But if you cannot prevent the speadsheet from being copied to a new location without locking access permissions. And as far as I know you cannot prevent the user from turning off macros. So it's not copy protection in that regard.

So, given that, if you want a macro to check that the Worksheet is located in a particular folder location, show a message box, and force it to quit if it is not in the right place, then here is one way...

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim sPath As String
sPath = ActiveWorkbook.Path
If (sPath <> "C:\Documents and Settings\Admin\Desktop") Then
MsgBox "This Excel worksheet only works in the original location."
ActiveWorkbook.Close
End If
End Sub

This version will check the location every time a selection is made.

Let me know if that helps, or if you have other questions and feel that I can assist further.

James

Ask Your Own Programming Question
Was this answer helpful?

How JustAnswer works

step-image
Describe your issueThe assistant will guide you
step-image
Chat 1:1 with a programmerLicensed Experts are available 24/7
step-image
100% satisfaction guaranteeGet all the answers you need
Ask Jim Clark Your Own Question
Jim Clark
Jim Clark
Jim Clark, Software Developer
Category: Programming
Satisfied Customers: 422
422 Satisfied Customers
Experience: 25 years of programming experience. 15 years in web development.

Jim Clark is online now

A new question is answered every 9 seconds

How JustAnswer works:

  • Ask an ExpertExperts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional AnswerVia email, text message, or notification as you wait on our site. Ask follow up questions if you need to.
  • 100% Satisfaction GuaranteeRate the answer you receive.

JustAnswer in the News:

Ask-a-doc Web sites: If you've got a quick question, you can try to get an answer from sites that say they have various specialists on hand to give quick answers... Justanswer.com.
JustAnswer.com...has seen a spike since October in legal questions from readers about layoffs, unemployment and severance.
Web sites like justanswer.com/legal
...leave nothing to chance.
Traffic on JustAnswer rose 14 percent...and had nearly 400,000 page views in 30 days...inquiries related to stress, high blood pressure, drinking and heart pain jumped 33 percent.
Tory Johnson, GMA Workplace Contributor, discusses work-from-home jobs, such as JustAnswer in which verified Experts answer people’s questions.
I will tell you that...the things you have to go through to be an Expert are quite rigorous.

What Customers are Saying:

My Expert answered my question promptly and he resolved the issue totally. This is a great service. I am so glad I found it I will definitely use the service again if needed.

One Happy CustomerNew York

Wonderful service, prompt, efficient, and accurate. Couldn't have asked for more. I cannot thank you enough for your help.

Mary C.Freshfield, Liverpool, UK

This expert is wonderful. They truly know what they are talking about, and they actually care about you. They really helped put my nerves at ease. Thank you so much!!!!

AlexLos Angeles, CA

Thank you for all your help. It is nice to know that this service is here for people like myself, who need answers fast and are not sure who to consult.

GPHesperia, CA

I couldn't be more satisfied! This is the site I will always come to when I need a second opinion.

JustinKernersville, NC

Just let me say that this encounter has been entirely professional and most helpful. I liked that I could ask additional questions and get answered in a very short turn around.

EstherWoodstock, NY

Thank you so much for taking your time and knowledge to support my concerns. Not only did you answer my questions, you even took it a step further with replying with more pertinent information I needed to know.

RobinElkton, Maryland

< Previous | Next >

Meet the Experts:

ATLPROG

ATLPROG

Computer Software Engineer

7,677 satisfied customers

MS in IT.Several years of programming experience in Java C++ C C# Python VB Javascript HTML

LogicPro

LogicPro

Computer Software Engineer

7,175 satisfied customers

Expert in C, C++, Java, DOT NET, Python, HTML, Javascript, Design.

unvadim

unvadim

Computer Software Engineer

1,168 satisfied customers

Good knowledge of OOP principles. 3+ years of programming experience with Java and C++. Sun Certified Java Programmer 5.0.

lifesaver

lifesaver

Computer Software Engineer

950 satisfied customers

Several years of intensive programming and application development experience in various platforms.

ehabtutor

ehabtutor

Computer Software Engineer

936 satisfied customers

Bachelor of computer science, 5+ years experience in software development, software company owner

TheDoctor

TheDoctor

Software Engineer

893 satisfied customers

M.S. in Internet Information Systems

The-PC-Guy

The-PC-Guy

Software Engineer

848 satisfied customers

Extensive Knowledge in PHP, MYSQL, CSS & Javascript

< Previous | Next >

Related Programming Questions
I have an excel spread sheet that has 15 columns. The Master
I have an excel spread sheet that has 15 columns. The Master Sheet which contains all the data is called DataSheet. Then I have additional sub worksheets where I want to copy the whole row to these va… read more
George Sibiya
George Sibiya
PhD
313 satisfied customers
Its an excel specific quesion...is there a reasource for
its an excel specific quesion...is there a reasource for that? … read more
Michael Rademacher
Michael Rademacher
MBA
13 satisfied customers
I use excel 2007. I have a large spreadsheet with around
I use excel 2007. I have a large spreadsheet with around 1000 values. I am looking for a way to find an answer to sums. I have a prticular sum of 24.23. Is there any way that I can ask the spreadsheet… read more
John D
John D
Bachelor Degree in Engineering
342 satisfied customers
Hi. I have a large excel spreadsheet ( 10 mb ) which I need
Hi. I have a large excel spreadsheet ( 10 mb ) which I need help with regarding graphs. I use MAC (Lion OS) and Microsoft Excel 2011. The excel spreadsheet is for data analysis which produces about 50… read more
John D
John D
Bachelor Degree in Engineering
342 satisfied customers
I have approx 300 excel files that contain information that
I have approx 300 excel files that contain information that I want to count. The information I want to count is a list of material codes. These codes and quantities are located in the same column in t… read more
John D
John D
Bachelor Degree in Engineering
342 satisfied customers
My question seems simple to me, but I have spent many hours
My question seems simple to me, but I have spent many hours searching for an answer. I am using Excel 2007, but want to also be able to do this in Excel 2003. Why can't I I am working with individual … read more
John D
John D
Bachelor Degree in Engineering
342 satisfied customers
I have an excel spreadsheet with two worksheets in it. In
I have an excel spreadsheet with two worksheets in it. In the first, I have all of my invoices that I have sent out, listed in columns by date, invoice #, amount invoiced,... In the second worksheet, … read more
John D
John D
Bachelor Degree in Engineering
342 satisfied customers
I have a spreadsheet and want to be able to instantly display
I have a spreadsheet and want to be able to instantly display certain data in a presentation which that at the moment I get through the laborious process of filtering. I need to access the data with o… read more
Alex
Alex
Sr. Software Engineer
Bachelor\u0027s Degree
332 satisfied customers
how can i setup my excel spreadsheet to copy cells from another
how can i setup my excel spreadsheet to copy cells from another spreadsheet so that the copy is done without having to use the time consuming manual copy and paste; example say; I have a spreadsheet l… read more
ATLPROG
ATLPROG
Computer Software Engineer
Master's Degree
7,677 satisfied customers
How do you set your file open search to handle partial names
How do you set your file open search to handle partial names so that all files containing that partial name will be displayed in excel?… read more
John D
John D
Bachelor Degree in Engineering
342 satisfied customers
NaveedP, I have been asking you the questions about the macro
NaveedP, I have been asking you the questions about the macro to create 2 columns of numbers in Excel. My most recent problem is the macro will not work when I copy it into MY file. It works great in … read more
John D
John D
Bachelor Degree in Engineering
342 satisfied customers
I have a spreadsheet with 7 columns and 10,613 rows. Column
I have a spreadsheet with 7 columns and 10,613 rows. Column A has 885 rows of unique 5 digit CPT Codes (codes used to describe medical procedures). Column C has 10,613 rows of all currently active uni… read more
John D
John D
Bachelor Degree in Engineering
342 satisfied customers
I am building an Excel based Product for sale to a select industry
I am building an Excel based Product for sale to a select industry group. Two questions: 1. How can I program the Excel Workksheet so that it cannot be readily copied by the targeted Users? 2. I have … read more
John D
John D
Bachelor Degree in Engineering
342 satisfied customers
I have an Excel system used by myself and several other people
I have an Excel system used by myself and several other people of varying ability. I have protected cells with formulas but people do some cutting in editing their data and cause #REF! error signals i… read more
John D
John D
Bachelor Degree in Engineering
342 satisfied customers
Excel macro to name a file based on a cell and also create
Excel macro to name a file based on a cell and also create a folder based on another cell. Ex: file name = "A1" path & folder = "A2"… read more
John D
John D
Bachelor Degree in Engineering
342 satisfied customers
How do I build menus in the menu bar in 2007 - I have menus
How do I build menus in the menu bar in 2007?- I have menus I have built using the 2004 macro code… read more
Cherryl Lewis
Cherryl Lewis
Bachelor's Degree
180 satisfied customers
I have built two consolidating spreadsheets of 50 columns each.
I have built two consolidating spreadsheets of 50 columns each. They are linked to the 50 individual source workbooks. On my spreadsheets I have enabled the automatic update feature. However, I am fin… read more
John D
John D
Bachelor Degree in Engineering
342 satisfied customers
I am running an excel macro that opens up powerpoint and copies
I am running an excel macro that opens up powerpoint and copies charts from excel to powerpoint. I run the macro through PHP using COM. For some reason, when running this excel macro through the brows… read more
Mike
Mike
Programmer
High School or GED
16 satisfied customers
Disclaimer: Information in questions, answers, and other posts on this site ("Posts") comes from individual users, not JustAnswer; JustAnswer is not responsible for Posts. Posts are for general information, are not intended to substitute for informed professional advice (medical, legal, veterinary, financial, etc.), or to establish a professional-client relationship. The site and services are provided "as is" with no warranty or representations by JustAnswer regarding the qualifications of Experts. To see what credentials have been verified by a third-party service, please click on the "Verified" symbol in some Experts' profiles. JustAnswer is not intended or designed for EMERGENCY questions which should be directed immediately by telephone or in-person to qualified professionals.

Disclaimer: Information in questions, answers, and other posts on this site ("Posts") comes from individual users, not JustAnswer; JustAnswer is not responsible for Posts. Posts are for general information, are not intended to substitute for informed professional advice (medical, legal, veterinary, financial, etc.), or to establish a professional-client relationship. The site and services are provided "as is" with no warranty or representations by JustAnswer regarding the qualifications of Experts. To see what credentials have been verified by a third-party service, please click on the "Verified" symbol in some Experts' profiles. JustAnswer is not intended or designed for EMERGENCY questions which should be directed immediately by telephone or in-person to qualified professionals.

Show MoreShow Less

Ask Your Question

x