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 = "HTMLURL"
.HTMLURL = "<Computed Value>/ExpenseTemplate?OpenPage"
' Make some general settings for the overall sheet.
.ViewableRange = "A1:i30"
.DisplayHorizontalScrollBar = False
.DisplayVerticalScrollBar = False
.DisplayRowHeaders = False
.DisplayColHeaders = False
.DisplayToolBar = False
.TitleBar.Caption = " Expense Report for "
' .range("H1:H19".autofitcolumns
.MaxHeight = "100%"
.MaxWidth = "100%"
.AutoFit = True
' Draw a black border around the spreadsheet. Note the use of c -- spreadsheet constants.
.range("A1:A30".Borders(c.ssEdgeLeft).Weight = c.owcLineWeightThick
.range("A1:A30".Borders(c.ssEdgeLeft).Color = "DarkBlue"
.range("A30:I30".Borders(c.ssEdgeBottom).Weight = c.owcLineWeightThick
.range("A30:I30".Borders(c.ssEdgeBottom).Color = "DarkBlue"
.range("I1:I30".Borders(c.ssEdgeRight).Weight = c.owcLineWeightThick
.range("I1:I30".Borders(c.ssEdgeRight).Color = "DarkBlue"
' Set some number formats on the spreadsheet.
.range("D625".NumberFormat="Currency"
.range("H6:H25".NumberFormat="Currency"
.range("F6:F25".NumberFormat="0.000"
.range("A6:A25".NumberFormat = "dd-mmm-yy"
.range("I28:I30".NumberFormat = "Currency"
' Align some titles to the right.
.range("A5:I5".HAlignment = c.ssHAlignCenter
.range("H28:H30".HAlignment = c.ssHAlignRight
' Protect the sheet so unlocked cells work.
.ActiveSheet.Protection.Enabled=true
' Unlock cells so user can enter data.
.range("B1:B3".locked=false
.range("E1:E3".locked=false
.range("A6:G25".locked=false
.range("I29".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
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 = "HTMLURL"
.HTMLURL = "<Computed Value>/ExpenseTemplate?OpenPage"
' Make some general settings for the overall sheet.
.ViewableRange = "A1:i30"
.DisplayHorizontalScrollBar = False
.DisplayVerticalScrollBar = False
.DisplayRowHeaders = False
.DisplayColHeaders = False
.DisplayToolBar = False
.TitleBar.Caption = " Expense Report for "
' .range("H1:H19".autofitcolumns
.MaxHeight = "100%"
.MaxWidth = "100%"
.AutoFit = True
' Draw a black border around the spreadsheet. Note the use of c -- spreadsheet constants.
.range("A1:A30".Borders(c.ssEdgeLeft).Weight = c.owcLineWeightThick
.range("A1:A30".Borders(c.ssEdgeLeft).Color = "DarkBlue"
.range("A30:I30".Borders(c.ssEdgeBottom).Weight = c.owcLineWeightThick
.range("A30:I30".Borders(c.ssEdgeBottom).Color = "DarkBlue"
.range("I1:I30".Borders(c.ssEdgeRight).Weight = c.owcLineWeightThick
.range("I1:I30".Borders(c.ssEdgeRight).Color = "DarkBlue"
' Set some number formats on the spreadsheet.
.range("D625".NumberFormat="Currency"
.range("H6:H25".NumberFormat="Currency"
.range("F6:F25".NumberFormat="0.000"
.range("A6:A25".NumberFormat = "dd-mmm-yy"
.range("I28:I30".NumberFormat = "Currency"
' Align some titles to the right.
.range("A5:I5".HAlignment = c.ssHAlignCenter
.range("H28:H30".HAlignment = c.ssHAlignRight
' Protect the sheet so unlocked cells work.
.ActiveSheet.Protection.Enabled=true
' Unlock cells so user can enter data.
.range("B1:B3".locked=false
.range("E1:E3".locked=false
.range("A6:G25".locked=false
.range("I29".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