473,808 Members | 2,797 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

xlNoSelection not persisting after the file is closed

46 New Member
Hello all,

I am creating a report generation program with VB 6.0 as front-end and Oracle 10i as back-end. My reqiurements are
1. User will query the database through the front-end.
2. The results will get populated in an MSHFlexGrid.
3. There will be a button at the bottom captioning "Export to excel" clicking which shoud generate an excel file with the data contained in the grid.
4. User must not be able to copy the data from the generated file. He should be able to see it without any passwords etc. being asked.

So, to solve the above problems, I have made a VB program. I have successfully achieved the first three objectives. For the requirement number four, I am using the following code:

Expand|Select|Wrap|Line Numbers
  1.     wksReport.Protect "something_secret"
  2.     wksReport.EnableSelection = xlNoSelection
The above code does protect the sheet and does not allow the user to select any cells. After that I am closing the workbook and here comes the problem into picture.

Actually when I am reopening the file (not programatically , just by double clicking the file), the sheet still is protected but user can very easily select the cells and copy them to a new sheet, thereby defeating the purpose of security and requirement number four.

My doubt is that the EnableSelection property is not persisting when the file is closed and is set to its default value when the file is reopened.

Kindly throw some light on this.

Thanks in anticipation.
Jan 8 '08
16 2550
Killer42
8,435 Recognized Expert Expert
Instead of saying "useless",
How about using some good words like "Does not fulfill my requirement"... ?
when some one is trying to help you out be generous in action..
Never mind.

vikas000000a, I just don't see how it can be done within the given restrictions. You are apparently stuck with MS Excel as the tool that must be used. MS say Excel cannot do it. What do you want from us?

Perhaps upgrading Excel would resolve the issue - I don't know.

Hm...

Just how "fixed" are the requirements? Perhaps you could password-protect the worksheet so it can only be opened by your program. Your program could then simply open it using the password you've built in, and set the protection on. Then you let the users go ahead with whatever they want to do. Does that sound feasible?
Jan 13 '08 #11
vikas000000a
46 New Member
Instead of saying "useless",
How about using some good words like "Does not fulfill my requirement"... ?
when some one is trying to help you out be generous in action..
Sorry QVeen72, I never did intend to offend you. It was a general slip of tongue. Take it easy just like the other person 'who actually is trying to help me' did.
Jan 14 '08 #12
vikas000000a
46 New Member
Never mind.

vikas000000a, I just don't see how it can be done within the given restrictions. You are apparently stuck with MS Excel as the tool that must be used. MS say Excel cannot do it. What do you want from us?

Perhaps upgrading Excel would resolve the issue - I don't know.

Hm...

Just how "fixed" are the requirements? Perhaps you could password-protect the worksheet so it can only be opened by your program. Your program could then simply open it using the password you've built in, and set the protection on. Then you let the users go ahead with whatever they want to do. Does that sound feasible?
Hello Killer,
Thanks for your kind of support. But the fact remains that my problem is still unresolved. I will further explore it on other sites.

Meanwhile, I found one hole in the wall. It is that if you make an excel file as usual (I mean, not programmaticall y), and then protect it with disallowing the the selection of cells, when you close and reopen the file, it does remain persisted as it is (the way I want it to be).

I think, I can somehow or the other make use of this fact. Although, I am not still very sure about it.

Anyway, thanks again.
Jan 14 '08 #13
Killer42
8,435 Recognized Expert Expert
Hello Killer,
Thanks for your kind of support. But the fact remains that my problem is still unresolved. I will further explore it on other sites.
Sorry we couldn't help more. If you do find an answer, I'm sure we'd all appreciate your letting us know. That will help anyone else who comes looking for the info in future.

Meanwhile, I found one hole in the wall. It is that if you make an excel file as usual (I mean, not programmaticall y), and then protect it with disallowing the the selection of cells, when you close and reopen the file, it does remain persisted as it is (the way I want it to be).
Now that is interesting! I wonder how that came about. The automation interface must be failing to set something that the "real" application does.

Maybe there is some way you can take advantage of it. For example, after you turn on the protection, perhaps you could display the spreadsheet and tell Windows that the user pressed Ctrl-S or something. A lot would depend on whether the bug is in the setting of the protection, or the save. The save seems more likely though, since you said that the protection works until the file is reopened.
Jan 15 '08 #14
vikas000000a
46 New Member
Sorry we couldn't help more. If you do find an answer, I'm sure we'd all appreciate your letting us know. That will help anyone else who comes looking for the info in future.

Now that is interesting! I wonder how that came about. The automation interface must be failing to set something that the "real" application does.

Maybe there is some way you can take advantage of it. For example, after you turn on the protection, perhaps you could display the spreadsheet and tell Windows that the user pressed Ctrl-S or something. A lot would depend on whether the bug is in the setting of the protection, or the save. The save seems more likely though, since you said that the protection works until the file is reopened.
I would certaily let the forum know when I encounter with the solution.
Jan 15 '08 #15
vikas000000a
46 New Member
Sorry we couldn't help more. If you do find an answer, I'm sure we'd all appreciate your letting us know. That will help anyone else who comes looking for the info in future.

Now that is interesting! I wonder how that came about. The automation interface must be failing to set something that the "real" application does.

Maybe there is some way you can take advantage of it. For example, after you turn on the protection, perhaps you could display the spreadsheet and tell Windows that the user pressed Ctrl-S or something. A lot would depend on whether the bug is in the setting of the protection, or the save. The save seems more likely though, since you said that the protection works until the file is reopened.

Hey Killer,
I got the solution of my problem. I installed MS Office 2007 and run the same program without any modification at all. Now the excel files are protected as I wanted them to be. As I have to give only the output excel files to the users, it doesn't bother me if the end user has got Office 2007 or not.

Finally, I did it man.
Feb 8 '08 #16
sistaskriket
1 New Member
I had exactly the same problem with Excel 2002.
With Excel 2003 the macrocode works as intended, meaning that NoSelection persists after Close.
When I open the worksheet manually the protected cells can not be selected. That goes for the entire worksheet.
In addition to that I also hide the columns where I have my protected cells..
Feb 23 '09 #17

Sign in to post your reply or Sign up for a free account.

Similar topics

2
3091
by: Citoyen du Monde | last post by:
Trying to get some ideas on a simple javascript project (to teach myself the language). I want to develop a client-side vocabulary practice application that would allow users to enter their own words, their own definitions plus an example of how the word is used in practice. It'll be all client side with - cookies? to get persistence so that the words won't disappear on me each time the page is closed (which is what happened when I
0
289
by: SK | last post by:
The Excel object that i created in my ASP.Net application is not get destroyed even after session is closed.In the code i have tried methods like .Quit,Marshal.ReleaseComObject etc to kill the object still it pesists.....Help
9
2110
by: Clive Moss | last post by:
Anyone help a beginner at VBA please? I am trying to find a way to use a variable throughout an application. I want to take the value from a log-in form (the user) and use it in most forms that user opens. I have tried a number of things but none seem to work TIA
1
1904
by: L Mehl | last post by:
A process presents frmSecond for user entry; user closes when done. Code for opening the form is DoCmd.OpenForm "frmSecond", acNormal, , strWHERE, , acDialog Problem: frmSecond does not remain on the screen. Instead, it shows again after the process calling it has completed. Can anyone tell me what might be causing it to "hide" itself until the process completes?
4
3621
by: Dave Veeneman | last post by:
When does serializing objects make more sense than persisting them to a database? I'm new to object serialization, and I'm trying to get a feel for when to use it. Here is an example: I'm writing an accounting application. I have a chart of accounts in the form of a containment hierarchy. A GeneralLedger contains a number of Accounts, and each of these Accounts can contain a Aubledger, which contains its own Accounts, and so on. The...
1
1670
by: lim | last post by:
What is the possible error that occurs when the Page_load event is not triggered during execution. In my page there's some basic server control. Is there any loops holes?
5
4842
by: Dick | last post by:
I have a GridView bound to an ObjectDataSource. I have a Button that calls GridView.DataBind. I want the row that is selected before the DataBind to still be selected afterwards. This happens automatically if the data doesn't change. But if records have been added or deleted then it looks as if some code is necessary: I've done this by using GridView.SelectedValue to get the key value of the currently selected Row and then by itterating...
4
1263
by: bozzzza | last post by:
Hi All, We have a busy website, and I was wondering if we should persist the data by storing the data table in a session or cookie, and when the user re-loads the page I can cast the session or cookie back to a datatable and rebind to the grid. This is a closed web system so there is no problem getting users to make sure cookies & javascript is enabled.
0
11315
ADezii
by: ADezii | last post by:
Most Access Users realize that Recordsets, being virtual representations of a Query, Table, or SQL Statement, exist only in our PC's memory. They, and the data they contain, literally exist at one specific moment in time - then gone the next. Few of us realize, however, that they can be saved to disk and later retrieved to will. The technical jargon for this is called 'Persisting a Recordset' and I'll show you how it can be done. ADO has this...
0
9721
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10373
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10113
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9195
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7651
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5685
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4331
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3859
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3011
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.