Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

is validation of excel cells possible on the web?

Status
Not open for further replies.

onename

Programmer
Oct 3, 2002
2
0
0
NL
Hi
I am creating a web form with an excel sheet in a notes database

The form opens in excel and an excel sheet appears.

i have managed to format cells paste values etc..

What i cant get working is validating a cell

I am not sure if it is supported in excel on the web?

i am trying to use a validation of length of the cell'
This is the code i have been meddling with to get working

Does validation work in this object?

'Validation Code
With ss.Range("C6:C25").Validation
.Delete
.Add Type:=xlValidateTextLength, AlertStyle:=xlValidAlertStop, Operator:=xlLessEqual, Formula1:="20" 'Syntax error is generated here
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = "Error"
.InputMessage = ""
.ErrorMessage = "Too many charcters"
.ShowInput = True
.ShowError = True
End With


Anyway my working code is below the above code i have been inserting before the end sub in the SetupSpreadsheet
function


</FORM>
<!--
Create the spreadsheet object.
-->
<CENTER>
<OBJECT
id=ss
classid=clsid:0002E510-0000-0000-C000-000000000046>
</OBJECT>
</CENTER>

<SCRIPT LANGUAGE=VBscript>

Dim c ' For spreadsheet constants.

Sub Window_OnLoad

' Window_OnLoad fires when the form is first composed, opened, or refreshed.
' Here, the spreadsheet is formatted and filled with formulas.
' If the expense report already exists, existing values are also inserted
' into the spreadsheet.

SetupSpreadsheet

End Sub

Sub SetupSpreadsheet

' SetupSpreadsheet applies the formatting to the sheet.

Set c = ss.Constants

with ss

' The ExpenseTemplate is a page created in this database. It has a table
' on it that has the headings and formulas for the spreadsheet. Binding
' the expense report form to the ExpenseTemplate, eliminates the need to set
' the headings and formulas in this code.
.DataType = &quot;HTMLURL&quot;
.HTMLURL = &quot;<Computed Value>/ExpenseTemplate?OpenPage&quot;

' Make some general settings for the overall sheet.
.ViewableRange = &quot;A1:i30&quot;
.DisplayHorizontalScrollBar = False
.DisplayVerticalScrollBar = False
.DisplayRowHeaders = False
.DisplayColHeaders = False
.DisplayToolBar = False
.TitleBar.Caption = &quot; Expense Report for &quot;
' .range(&quot;H1:H19&quot;).autofitcolumns
.MaxHeight = &quot;100%&quot;
.MaxWidth = &quot;100%&quot;
.AutoFit = True

' Draw a black border around the spreadsheet. Note the use of c -- spreadsheet constants.
.range(&quot;A1:A30&quot;).Borders(c.ssEdgeLeft).Weight = c.owcLineWeightThick
.range(&quot;A1:A30&quot;).Borders(c.ssEdgeLeft).Color = &quot;DarkBlue&quot;
.range(&quot;A30:I30&quot;).Borders(c.ssEdgeBottom).Weight = c.owcLineWeightThick
.range(&quot;A30:I30&quot;).Borders(c.ssEdgeBottom).Color = &quot;DarkBlue&quot;
.range(&quot;I1:I30&quot;).Borders(c.ssEdgeRight).Weight = c.owcLineWeightThick
.range(&quot;I1:I30&quot;).Borders(c.ssEdgeRight).Color = &quot;DarkBlue&quot;

' Set some number formats on the spreadsheet.
.range(&quot;D6:D25&quot;).NumberFormat=&quot;Currency&quot;
.range(&quot;H6:H25&quot;).NumberFormat=&quot;Currency&quot;
.range(&quot;F6:F25&quot;).NumberFormat=&quot;0.000&quot;
.range(&quot;A6:A25&quot;).NumberFormat = &quot;dd-mmm-yy&quot;
.range(&quot;I28:I30&quot;).NumberFormat = &quot;Currency&quot;


' Align some titles to the right.
.range(&quot;A5:I5&quot;).HAlignment = c.ssHAlignCenter
.range(&quot;H28:H30&quot;).HAlignment = c.ssHAlignRight

' Protect the sheet so unlocked cells work.
.ActiveSheet.Protection.Enabled=true

' Unlock cells so user can enter data.
.range(&quot;B1:B3&quot;).locked=false
.range(&quot;E1:E3&quot;).locked=false
.range(&quot;A6:G25&quot;).locked=false
.range(&quot;I29&quot;).locked=false

' Validation Code goes here

End With
End Sub

if anyone can help me get this working or tell me if this method works on the web then i would be very appreciative.

Thanks

Mike
 
hmm, i think you have CVS confused with CSV. it happens to me too.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top