我需要帮助。
基本上代码的作用是从excel文件中获取数据并通过htm显示它。发生这种情况是因为我的公司不会为我提供一个数据库和php服务器,这会让事情变得更容易。
问题是代码正在使用WinXP。但最近,我们转换到Win7,突然间代码似乎不再起作用了。
我查看IE11 F12控制台时收到的错误是answerkey()未定义。
<HTML>
<HEAD>
<TITLE></TITLE>
</HEAD>
<BODY>
<style type="text/css">
.main{WIDTH: 100%; background-color: #ACDFE7;font-family: arial; font-size: 10pt;}
.main tr td{padding: 2pt 8pt;}
.header{font-size: 2em; text-align: center; font-family: arial;}
</style>
<SCRIPT type="text/vbscript">
function answerkey()
Dim strYourFile : strYourFile ="C:\Users\MilesF\Desktop\Q1\users\answers.xlsx"
Dim strYourSheet : strYourSheet = "Sheet1"
Dim objExcel : Set objExcel = CreateObject("Excel.Application")
objExcel.DisplayAlerts = False
objExcel.Visible = False
set objWorkbook = objExcel.Workbooks.Open(strYourFile)
set objWorksheet = objWorkbook.Worksheets(strYourSheet)
names = document.myguestbook.name.value
If names ="MarianB" Then
document.write("<p align=left><font face=sans-serif size=4><B>Examinee:</B> <U><font color=red>MarianB</font></U></font></p><p align=left><font face=sans-serif size=2><B>Job Process:</b> I - First Investor</font></p><p align=left><font face=arial size=2>1. Identify the two differences of spread and single pdf output? <B>(4pts)</B></font></p><p align=left><font face=arial size=2>Answer: <font color=red><B>" & objWorksheet.Cells(3, 2).Value & "</b></font></font></p><BR><p align=left><font face=arial size=2>2. What type of command you should do to create a spread output? <B>(2pts)</B> </font></p><p align=left><font face=arial size=2>Answer: <font color=red><B>" & objWorksheet.Cells(4, 2).Value & "</b></font></font></p><BR><p align=left><font face=arial size=2>3. The document always consists of 4 pages. After the initial your outputs are more than 4 pages what will you do? <B>(2pts)</B></font></p><p align=left><font face=arial size=2>Answer: <font color=red><B>" & objWorksheet.Cells(5, 2).Value & "</b></font></font></p><BR><p align=left><font face=arial size=2>4. What is the trim size of single and spread? <B>(3pts)</B></font></p><p align=left><font face=arial size=2>Answer: <font color=red><B>" & objWorksheet.Cells(6, 2).Value & "</b></font></font></p><BR><p align=left><font face=sans-serif size=2><B>Job Process:</b> II - ImmuPharma</font></p><p align=left><font face=arial size=2>1. Where the section pages are usually started in the document? What are the content of the section page? <B>(5pts)</B></font></p><p align=left><font face=arial size=2>Answer: <font color=red><B>" & objWorksheet.Cells(10, 2).Value & "</b></font></font></p><BR><p align=left><font face=arial size=2>2. What is the purpose of having different sizes/dpi of photos on their list? <B>(3pts)</B></font></p><p align=left><font face=arial size=2>Answer: <font color=red><B>" & objWorksheet.Cells(11, 2).Value & "</b></font></font></p><BR><p align=left><font face=arial size=2>3. What do we also consider in selecting the photos for the client to buy given the fact that the FPO photos are now in place? <B>(3pts)</B></font></p><p align=left><font face=arial size=2>Answer: <font color=red><B>" & objWorksheet.Cells(12, 2).Value & "</b></font></font></p><BR><p align=left><font face=arial size=2>4. These are the part of the document that we generate PDF output in spread and in separately. What are these parts? <B>(3pts)</B></font></p><p align=left><font face=arial size=2>Answer: <font color=red><B>" & objWorksheet.Cells(13, 2).Value & "</b></font></font></p><BR><p align=left><font face=sans-serif size=2><B>Job Process:</b> Liontrust R&A</font></p><p align=left><font face=arial size=2>1. Name the three main section of this type of liontrust. <B>(6pts)</B></font></p><p align=left><font face=arial size=2>Answer: <font color=red><B>" & objWorksheet.Cells(17, 2).Value & "</b></font></font></p><BR><p align=left><font face=arial size=2>2. This part has a separate of the indesign file and must spread in PDF output. What are these parts? <B>(4pts)</B></font></p><p align=left><font face=arial size=2>Answer: <font color=red><B>" & objWorksheet.Cells(18, 2).Value & "</b></font></font></p><BR><p align=left><font face=arial size=2>3. This is a supplied PDF from the client and also a part of the document that needs to be placed in a particular section. What do call this insert? Where they should be placed? <B>(5pts)</B></font></p><p align=left><font face=arial size=2>Answer: <font color=red><B>" & objWorksheet.Cells(19, 2).Value & "</b></font></font></p><BR><p align=left><font face=sans-serif size=2><B>Job Process:</b> MFC 6-K</font></p><p align=left><font face=arial size=2>1. Name at least one of two part of the document does have page border. <B>(2pts)</B></font></p><p align=left><font face=arial size=2>Answer: <font color=red><B>" & objWorksheet.Cells(23, 2).Value & "</b></font></font></p><BR><p align=left><font face=arial size=2>2. This is the part of the document that usually the client sends or tells to us to follow style source and its page break. <B>(2pts)</B></font></p><p align=left><font face=arial size=2>Answer: <font color=red><B>" & objWorksheet.Cells(24, 2).Value & "</b></font></font></p><BR>")
End If
objWorkbook.Save
Set objWorksheet = Nothing
objWorkbook.Close
set objWorkbook = Nothing
objExcel.Quit
set objExcel = Nothing
End Function
</script>
<Body>
<FORM id=myguestbook name=myguestbook method=post><BR>
<select name="name">
<option value=""> </option>
<option value="MarianB">Marian Berso</option>
<option value="JiomerD">Jiomer Dacaymat</option>
<option value="JoyD">Joy Daffon</option>
<option value="LeoD">John Leo Dela Rosa</option>
<option value="NestorG">Nestor Garlan Jr.</option>
<option value="EdelaineP">Edelaine Pasadas</option>
<option value="RamelP">Ramel Pasadas</option>
<option value="AbigaelS">Abigael Serrano</option>
<option value="AlonzoV">Alonzo Villaflor</option>
</select>
<INPUT onclick=VBscript:answerkey() type=submit value=SUBMIT name=functional></form>
</BODY>
</HTML>
PS。我不确定这些代码是否真的是VBscript,因为我的一位同事刚刚把它给了我,然后我就这样做了。