473,799 Members | 3,158 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 #1
16 2549
Killer42
8,435 Recognized Expert Expert
I don't know much about it, but I have one question. When you refer to "closing" the file after setting the protection - are you saving it?
Jan 8 '08 #2
QVeen72
1,445 Recognized Expert Top Contributor
Hi,

Not sure of this , but the coding Sequence should be in reverse order (Check Excel Help):

Expand|Select|Wrap|Line Numbers
  1. wksReport.EnableSelection = xlNoSelection
  2. wksReport.Protect "something_secret"
  3.  
and as Killer said, dont forget to save the sheet before quitting..

Regards
Veena
Jan 8 '08 #3
vikas000000a
46 New Member
I am definitely saving the file before closing it.

Also, I have tried it both the ways, i.e., first protect then setting EnableSelection property and vice-versa. Actually it doesn't matter what you do first beacuse I am anyway saving the file before closing it. So every operation on the workbook should get saved.

Any other expert can show me the way???
Jan 9 '08 #4
vikas000000a
46 New Member
Is anybody there to help me out on this?
Jan 10 '08 #5
Killer42
8,435 Recognized Expert Expert
Ahah! Pretty sure I found your answer. MS acknowledge the problem, and have a workaround, though not really a solution.

See Some of the properties of worksheets are not preserved in Excel
Jan 11 '08 #6
vikas000000a
46 New Member
Ahah! Pretty sure I found your answer. MS acknowledge the problem, and have a workaround, though not really a solution.

See Some of the properties of worksheets are not preserved in Excel
I read the article and got your point. But now, is there any other way to achieve my requirement number four.

I cann't put macros in programatically generated excel files beacuse they are hundreds in number and also many people keep macros disabled for security reasons.
Jan 11 '08 #7
Killer42
8,435 Recognized Expert Expert
I read the article and got your point. But now, is there any other way to achieve my requirement number four.

I cann't put macros in programatically generated excel files beacuse they are hundreds in number and also many people keep macros disabled for security reasons.
With MS effectively throwing up their hands in defeat, I don't see how it could be done. I only glanced at the article - there was no patch or anything?

The only other alternatives I can think of are...
  • Use a different spreadsheet program instead of Excel.
  • Display the data in your own program, rather than using spreadsheet.
  • Use your program to drive Excel for display purposes, and do what the macro might not be able to do.
Jan 11 '08 #8
vikas000000a
46 New Member
With MS effectively throwing up their hands in defeat, I don't see how it could be done. I only glanced at the article - there was no patch or anything?

The only other alternatives I can think of are...
  • Use a different spreadsheet program instead of Excel.
  • Display the data in your own program, rather than using spreadsheet.
  • Use your program to drive Excel for display purposes, and do what the macro might not be able to do.

All of your alternatives are useless for me as my client requirements are fixed and have been mutually agreed between us months back. It will be something like taking up the challenge and then stepping backward saying that I didn't know that it is not possible using Microsoft Technologies.
Jan 12 '08 #9
QVeen72
1,445 Recognized Expert Top Contributor
All of your alternatives are useless for me as my client requirements are fixed and have been mutually agreed between us months back.
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..
Jan 12 '08 #10

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

Similar topics

2
3090
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
2109
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
1902
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
4841
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
1262
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
11313
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
9685
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
10470
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10247
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...
1
10214
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10023
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...
1
7561
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...
1
4135
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
3751
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2935
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.