Aleniko


Hi all;

- Is there a way to lock cells so the excel user can't modify them
- I am trying to setup an excel sheet where each line in the sheet may neet to have multpiple 'child items' which the user needs to create. For example an order line item which the user may need to break into different production status lines. Is this something that can be done in excel

Thank you all,
AK.



Re: Some more Excel automation questions

Naomi Nosonovsky


1. Yes, this can easily be done. In the sample DBFToExcel function I posted in another thread here there was a sample doing this, I also saw samples recently on another forum.

Here is a function sample

http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=1607610&SiteID=1

Code Snippet

IF m.tlLockHeaderRow && we need to prevent headers from modifying
** Code from Borislav Borissov
loSheet.UsedRange.SELECT
loExcel.SELECTION.Locked = .F. && First we need to UNLOCK all cells
loExcel.ROWS(m.lnLines + m.lnoffset).SELECT && Select the header row of the sheet
loExcel.SELECTION.Locked = .T. && Lock Cells in the header row
loExcel.ActiveWorkbook.ActiveSheet.PROTECT(,.T.,,.T.)
ENDIF

2. Perhaps it's better to be done in MSHFlexGrid.






Re: Some more Excel automation questions

Alex Feldstein

Aleniko wrote:
Hi all;

- Is there a way to lock cells so the excel user can't modify them
- I am trying to setup an excel sheet where each line in the sheet may neet to have multpiple 'child items' which the user needs to create. For example an order line item which the user may need to break into different production status lines. Is this something that can be done in excel

Thank you all,
AK.

You need to play with creating an Excel macro that records your actions to see how it's done. Basically you are talking about a template that works like a form with some cells open and some locked. Look ion the Excel menu under Tools|Protection. One you understand how it's done, it is fairly easy to translate to VFP code to automate the process.






Re: Some more Excel automation questions

Alex Feldstein

Naomi Nosonovsky wrote:
2. Perhaps it's better to be done in MSHFlexGrid - an example just posted by Cetin Basoz in http://www.universalthread.com/wconnect/wc.dll 2,15,1228989 thread.

Naomi,

Please do not link to UT's threads, a site that requires registration. As you recall, Andy already made it abundantly clear to you. Let's not rehash that thread, shall we If you have any questions, we can take it offline. Let's not deviate this thread form the poster's question.





Re: Some more Excel automation questions

Naomi Nosonovsky

Perhaps this forum also has samples of using MSHFlexGrid as I was suggesting, I didn't run a search here, I admit, but since the other post was from today, it was easier to refer to it.

But I just ran a search here on the site for MSHFlexGrid and found only 4 references (3 for this thread) with no code samples.

BTW, here is a sample with a link http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=132908&SiteID=1 Why again double standards Anyway, appreciate off-line discussion (nnosonovsky at gmail dot com)





Re: Some more Excel automation questions

Aleniko

Thank you all.
Anyone has an idea for the second part of my question

AK.




Re: Some more Excel automation questions

Naomi Nosonovsky

For your second question I don't see how can you achieve this functionality in Excel. Of course, you can always add rows with extra information, but Excel is not hierarhical, so it is not really suited for the task.



Re: Some more Excel automation questions

Aleniko

That's what I suspected.

Thanks again!