Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Writing to protected sheet from ASP.NET

I need to write to a protected excel worksheet. So far i have code which can
write to an unprotected sheet as below:

Help would be much appreciated

++++++++++++++++++++++++++++++++++++++++++++++

Private Sub WriteIDtoXL(ByVal str)
Dim conn1 As New System.Data.OleDb.OleDbConnection(xlConn(str))
conn1.Open()

Dim cmd As New System.Data.OleDb.OleDbCommand
cmd.Connection = conn1
cmd.CommandText = "INSERT INTO [CCID] (ID) values (" &
Session("mCallCentreID") & ")"
cmd.ExecuteNonQuery()
conn1.Close()

End Sub

Private Function xlConn(ByVal FilePath As String) As String

xlConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
FilePath & ";Extended Properties=""Excel 8.0;HDR=YES;MAXSCANROWS=4"""

End Function

++++++++++++++++++++++++++++++++++++++++++++++++++ +++
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Writing to protected sheet from ASP.NET

Hi Jamie

Thanks for your response.

I did write some code which launches excel on the server, unprotects the
sheet and the saves and closes the file. Then the ado.net code inserts
some data. The protection code is then rerun and protects the sheet. But
after saving and then closing the spread, it would trigger the
BeforeClose event in the actual spread! Any ideas?

What i dont understand is why this isnt triggered during the initial
unprotect process?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 593
Default Writing to protected sheet from ASP.NET

Winshent P wrote ...

I did write some code which launches excel on the server, unprotects the
sheet and the saves and closes the file. Then the ado.net code inserts
some data. The protection code is then rerun and protects the sheet. But
after saving and then closing the spread, it would trigger the
BeforeClose event in the actual spread! Any ideas?

What i dont understand is why this isnt triggered during the initial
unprotect process?


Are you saying the BeforeClose event doesn't fire when the only
difference is unprotecting rather than protecting? Sorry, I can't
think of a reason for that behaviour unless there is something in in
the workbook conditionally blocking the event.

Jamie.

--
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
Allow only writing in a protected Sheet Piruzzi Setting up and Configuration of Excel 1 January 5th 09 11:59 PM
Writing formulas between sheet Dave Excel Discussion (Misc queries) 4 February 22nd 07 05:50 PM
Select writing area in sheet Kathrine J Wathne[_2_] Excel Programming 1 October 20th 04 07:31 PM
writing to excel sheet Sara Excel Programming 1 September 20th 04 07:02 PM
Need help with writing variant back to sheet bri0710 Excel Programming 6 August 16th 04 07:08 PM


All times are GMT +1. The time now is 04:37 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"