You need to sign in to do that
Don't have an account?
kutts18
vbscript in VF page
I have a vbscript code inside my VF page,
which reads an excel file and displays the content
in a textarea.
Its not working at all. ie if you click the Read button
nothing happens.
Does VF pages support vbscript code?
Here is my code
<apex:page showHeader="false">
<apex:messages />
<script type="text/vbscript">
Sub readBtn_OnClick
Dim fileUrl
Dim rowIndex
Dim colIndex
Dim oldContent
Dim newContent
Dim cellContent
fileUrl = document.form.userFile.value
Set objExcel = CreateObject("Excel.Application")
MsgBox "Excel Obj Created"
Set objWorkbook = objExcel.Workbooks.Open(fileUrl)
MsgBox "Excel Workbook Created"
rowIndex = 1
colIndex = 1
Do Until objExcel.Cells(rowIndex ,colIndex).Value = ""
oldContent = document.form.excelContent.value
newContent = oldContent & objExcel.Cells(rowIndex , colIndex).Value & vbCr & vbLf
document.form.excelContent.value = newContent
rowIndex = rowIndex + 1
Loop
objExcel.Workbooks(1).Close
objExcel.Quit
End Sub
</script>
<form name="form">
<input type="file" name="userFile"/>
<input type="button" value="Read" name="readBtn"/>
<p><textarea rows="10" cols="44" name="excelContent"></textarea></p>
</form>
</apex:page>
I tested this in Mozilla Firefox
Mozilla Firefox DO NOT SUPPORT ACTIVEX
so i tested in IE,its working fine when
giving appropriate security permissions.
http://support.mozilla.com/en-US/kb/ActiveX
All Answers
I tested this in Mozilla Firefox
Mozilla Firefox DO NOT SUPPORT ACTIVEX
so i tested in IE,its working fine when
giving appropriate security permissions.
http://support.mozilla.com/en-US/kb/ActiveX
- Set to 'Prompt'
Initialize and script ActiveX controls not marked as safe