Hi,
I'm trying to show data (5 days at a time) from sheets in Excel (based on current date) on a web page. I have the code working, except for when the five days includes 2 different months. Like today, the data for tomorrow would be on a sheet called May instead of April. For some reason, my web page shows no data after today! Here is an example of the code, I would appreciate any help since I'm new at this! Here is the beginning of my code, I won't post all of it because it's 13 pages alltogether! Thanks!
<SCRIPT language=vbscript>
function getXls()
'get variables
mnth = MonthName(Month(Now), 1)
mnth1 = Monthname(Month(Dateserial(year(now), month(now), day(now)+1)))
mnth2 = Monthname(Month(Dateserial(year(now), month(now), day(now)+2)))
mnth3 = Monthname(Month(Dateserial(year(now), month(now), day(now)+3)))
mnth4 = Monthname(Month(Dateserial(year(now), month(now), day(now)+4)))
'Open Workbook
set excelObj = CreateObject("excel.application"
on error goto 0
excelObj.Workbooks.Open "c:\test.xls", True
excelObj.ActiveSheet.Cells(1, 1).Activate
excelObj.ActiveCell.Offset(1, Day(Now)+2).Activate
form1.r113a.value = excelObj.ActiveCell.value
excelObj.ActiveCell.Offset(1, 0).Activate
form1.r113b.value = excelObj.ActiveCell.value
excelObj.ActiveCell.Offset(1, 0).Activate
form1.r113c.value = excelObj.ActiveCell.value
excelObj.ActiveCell.Offset(1, 0).Activate
form1.r113d.value = excelObj.ActiveCell.value
excelObj.ActiveSheet.Cells(1, 1).Activate
excelObj.ActiveCell.Offset(5, Day(Now)+2).Activate
form1.r115a.value = excelObj.ActiveCell.value
excelObj.ActiveCell.Offset(1, 0).Activate
form1.r115b.value = excelObj.ActiveCell.value
excelObj.ActiveCell.Offset(1, 0).Activate
form1.r115c.value = excelObj.ActiveCell.value
excelObj.ActiveCell.Offset(1, 0).Activate
form1.r115d.value = excelObj.ActiveCell.value
excelObj.ActiveSheet.Cells(1, 1).Activate
excelObj.ActiveCell.Offset(9, Day(Now)+2).Activate
form1.r117a.value = excelObj.ActiveCell.value
excelObj.ActiveCell.Offset(1, 0).Activate
form1.r117b.value = excelObj.ActiveCell.value
excelObj.ActiveCell.Offset(1, 0).Activate
form1.r117c.value = excelObj.ActiveCell.value
excelObj.ActiveCell.Offset(1, 0).Activate
form1.r117d.value = excelObj.ActiveCell.value
excelObj.ActiveSheet.Cells(1, 1).Activate
excelObj.ActiveCell.Offset(13, Day(Now)+2).Activate
form1.r119a.value = excelObj.ActiveCell.value
excelObj.ActiveCell.Offset(1, 0).Activate
form1.r119b.value = excelObj.ActiveCell.value
excelObj.ActiveCell.Offset(1, 0).Activate
form1.r119c.value = excelObj.ActiveCell.value
excelObj.ActiveCell.Offset(1, 0).Activate
form1.r119d.value = excelObj.ActiveCell.value
excelObj.ActiveSheet.Cells(1, 1).Activate
excelObj.ActiveCell.Offset(17, Day(Now)+2).Activate
form1.r121a.value = excelObj.ActiveCell.value
excelObj.ActiveCell.Offset(1, 0).Activate
form1.r121b.value = excelObj.ActiveCell.value
excelObj.ActiveCell.Offset(1, 0).Activate
form1.r121c.value = excelObj.ActiveCell.value
excelObj.ActiveCell.Offset(1, 0).Activate
form1.r121d.value = excelObj.ActiveCell.value
excelObj.Worksheets(mnth1).Activate
excelObj.ActiveSheet.Cells(1, 1).Activate
excelObj.ActiveCell.Offset(1, Day(Now)+3).Activate
form1.r113a1.value = excelObj.ActiveCell.value
excelObj.ActiveCell.Offset(1, 0).Activate
form1.r113b1.value = excelObj.ActiveCell.value
excelObj.ActiveCell.Offset(1, 0).Activate
form1.r113c1.value = excelObj.ActiveCell.value
excelObj.ActiveCell.Offset(1, 0).Activate
form1.r113d1.value = excelObj.ActiveCell.value
excelObj.ActiveSheet.Cells(1, 1).Activate
excelObj.ActiveCell.Offset(5, Day(Now)+3).Activate
form1.r115a1.value = excelObj.ActiveCell.value
excelObj.ActiveCell.Offset(1, 0).Activate
form1.r115b1.value = excelObj.ActiveCell.value
excelObj.ActiveCell.Offset(1, 0).Activate
form1.r115c1.value = excelObj.ActiveCell.value
excelObj.ActiveCell.Offset(1, 0).Activate
form1.r115d1.value = excelObj.ActiveCell.value
excelObj.ActiveSheet.Cells(1, 1).Activate
excelObj.ActiveCell.Offset(9, Day(Now)+3).Activate
form1.r117a1.value = excelObj.ActiveCell.value
excelObj.ActiveCell.Offset(1, 0).Activate
form1.r117b1.value = excelObj.ActiveCell.value
excelObj.ActiveCell.Offset(1, 0).Activate
form1.r117c1.value = excelObj.ActiveCell.value
excelObj.ActiveCell.Offset(1, 0).Activate
form1.r117d1.value = excelObj.ActiveCell.value
excelObj.ActiveSheet.Cells(1, 1).Activate
excelObj.ActiveCell.Offset(13, Day(Now)+3).Activate
form1.r119a1.value = excelObj.ActiveCell.value
excelObj.ActiveCell.Offset(1, 0).Activate
form1.r119b1.value = excelObj.ActiveCell.value
excelObj.ActiveCell.Offset(1, 0).Activate
form1.r119c1.value = excelObj.ActiveCell.value
excelObj.ActiveCell.Offset(1, 0).Activate
form1.r119d1.value = excelObj.ActiveCell.value
excelObj.ActiveSheet.Cells(1, 1).Activate
excelObj.ActiveCell.Offset(17, Day(Now)+3).Activate
form1.r121a1.value = excelObj.ActiveCell.value
excelObj.ActiveCell.Offset(1, 0).Activate
form1.r121b1.value = excelObj.ActiveCell.value
excelObj.ActiveCell.Offset(1, 0).Activate
form1.r121c1.value = excelObj.ActiveCell.value
excelObj.ActiveCell.Offset(1, 0).Activate
form1.r121d1.value = excelObj.ActiveCell.value
'Close Workbook and Excel Object
excelObj.DisplayAlerts = False
excelObj.Workbooks.Close
set excelObj = nothing
end function
</SCRIPT>
<BODY onload="vbscript:getXls()">
<FORM name=form1>
<p align="right"><b><font size="5" color="#660066" face="Arial">test-
<script language = vbscript>
document.write Dateserial(year(now), month(now), day(now)) & " " & weekdayname(Weekday(day(now)+2))
</script>
</font></b></td>
<td width="199" bgcolor="#660066" height="19" style="border-left-style:none; border-right-style:solid; border-right-color:#660066; border-top-style:none; border-bottom-style:none">
<p align="left"><font color="#FFFFFF" face="Arial" size="2"><b>
<script language = vbscript>
document.write Dateserial(year(now), month(now), day(now)+1) & " " & weekdayname(Weekday(day(now)+3))
</script>
</b></font></td>
<td width="178" bgcolor="#660066" height="19" style="border-left-style:none; border-right-style:solid; border-right-color:#660066; border-top-style:none; border-bottom-style:none">
<p align="left"><font color="#FFFFFF" face="Arial" size="2"><b>
<script language = vbscript>
document.write Dateserial(year(now), month(now), day(now)+2) & " " & weekdayname(Weekday(day(now)+4))
</script>
</b></font></td>
<td width="178" bgcolor="#660066" height="19" style="border-left-style:none; border-right-style:solid; border-right-color:#660066; border-top-style:none; border-bottom-style:none">
<p align="left"><font color="#FFFFFF" face="Arial" size="2"><b>
<script language = vbscript>
document.write Dateserial(year(now), month(now), day(now)+3) & " " & weekdayname(Weekday(day(now)+5))
</script>
</b></font></td>
<td width="178" bgcolor="#660066" height="19" style="border-left-style:none; border-right-style:solid; border-right-color:#660066; border-top-style:none; border-bottom-style:none">
<p align="left"><font color="#FFFFFF" face="Arial" size="2"><b>
<script language = vbscript>
document.write Dateserial(year(now), month(now), day(now)+4) & " " & weekdayname(Weekday(day(now)+6))
</script>
</b></font></td>
</tr>
<tr>
<td width="128" bgcolor="#FFFF00" height="29" style="border-style: none; border-width: medium">
<font face="Arial" style="font-size: 9pt">Room 113</font></td> <td width="246" bgcolor="#FFFF00" height="29" style="border-style: none; border-width: medium" align="center">
<font face="Arial" style="font-size: 9pt">a</font></td>
<td width="150" style="border-left-style:none; border-right-style:solid; border-right-color:#660066; border-top-style:none; border-bottom-style:none" bgcolor="#FFFF00" height="29">
</td>
<td width="178" style="border-left-style:none; border-right-style:solid; border-right-color:#660066; border-top-style:none; border-bottom-style:none" height="29"> <font size="1"> <INPUT name=r113a size="27" style="border: 1px solid #FFFFFF;"></font></td>
<td width="199" style="border-left-style:none; border-right-style:solid; border-right-color:#660066; border-top-style:none; border-bottom-style:none" height="29"> <INPUT name=r113a1 size="27" style="border: 1px solid #FFFFFF;"></td>
<td width="178" style="border-left-style:none; border-right-style:solid; border-right-color:#660066; border-top-style:none; border-bottom-style:none" height="29"> <INPUT name=r113a2 size="27" style="border: 1px solid #FFFFFF;"></td>
</tr>
</table>
</FORM></BODY></HTML>
I'm trying to show data (5 days at a time) from sheets in Excel (based on current date) on a web page. I have the code working, except for when the five days includes 2 different months. Like today, the data for tomorrow would be on a sheet called May instead of April. For some reason, my web page shows no data after today! Here is an example of the code, I would appreciate any help since I'm new at this! Here is the beginning of my code, I won't post all of it because it's 13 pages alltogether! Thanks!
<SCRIPT language=vbscript>
function getXls()
'get variables
mnth = MonthName(Month(Now), 1)
mnth1 = Monthname(Month(Dateserial(year(now), month(now), day(now)+1)))
mnth2 = Monthname(Month(Dateserial(year(now), month(now), day(now)+2)))
mnth3 = Monthname(Month(Dateserial(year(now), month(now), day(now)+3)))
mnth4 = Monthname(Month(Dateserial(year(now), month(now), day(now)+4)))
'Open Workbook
set excelObj = CreateObject("excel.application"
on error goto 0
excelObj.Workbooks.Open "c:\test.xls", True
excelObj.ActiveSheet.Cells(1, 1).Activate
excelObj.ActiveCell.Offset(1, Day(Now)+2).Activate
form1.r113a.value = excelObj.ActiveCell.value
excelObj.ActiveCell.Offset(1, 0).Activate
form1.r113b.value = excelObj.ActiveCell.value
excelObj.ActiveCell.Offset(1, 0).Activate
form1.r113c.value = excelObj.ActiveCell.value
excelObj.ActiveCell.Offset(1, 0).Activate
form1.r113d.value = excelObj.ActiveCell.value
excelObj.ActiveSheet.Cells(1, 1).Activate
excelObj.ActiveCell.Offset(5, Day(Now)+2).Activate
form1.r115a.value = excelObj.ActiveCell.value
excelObj.ActiveCell.Offset(1, 0).Activate
form1.r115b.value = excelObj.ActiveCell.value
excelObj.ActiveCell.Offset(1, 0).Activate
form1.r115c.value = excelObj.ActiveCell.value
excelObj.ActiveCell.Offset(1, 0).Activate
form1.r115d.value = excelObj.ActiveCell.value
excelObj.ActiveSheet.Cells(1, 1).Activate
excelObj.ActiveCell.Offset(9, Day(Now)+2).Activate
form1.r117a.value = excelObj.ActiveCell.value
excelObj.ActiveCell.Offset(1, 0).Activate
form1.r117b.value = excelObj.ActiveCell.value
excelObj.ActiveCell.Offset(1, 0).Activate
form1.r117c.value = excelObj.ActiveCell.value
excelObj.ActiveCell.Offset(1, 0).Activate
form1.r117d.value = excelObj.ActiveCell.value
excelObj.ActiveSheet.Cells(1, 1).Activate
excelObj.ActiveCell.Offset(13, Day(Now)+2).Activate
form1.r119a.value = excelObj.ActiveCell.value
excelObj.ActiveCell.Offset(1, 0).Activate
form1.r119b.value = excelObj.ActiveCell.value
excelObj.ActiveCell.Offset(1, 0).Activate
form1.r119c.value = excelObj.ActiveCell.value
excelObj.ActiveCell.Offset(1, 0).Activate
form1.r119d.value = excelObj.ActiveCell.value
excelObj.ActiveSheet.Cells(1, 1).Activate
excelObj.ActiveCell.Offset(17, Day(Now)+2).Activate
form1.r121a.value = excelObj.ActiveCell.value
excelObj.ActiveCell.Offset(1, 0).Activate
form1.r121b.value = excelObj.ActiveCell.value
excelObj.ActiveCell.Offset(1, 0).Activate
form1.r121c.value = excelObj.ActiveCell.value
excelObj.ActiveCell.Offset(1, 0).Activate
form1.r121d.value = excelObj.ActiveCell.value
excelObj.Worksheets(mnth1).Activate
excelObj.ActiveSheet.Cells(1, 1).Activate
excelObj.ActiveCell.Offset(1, Day(Now)+3).Activate
form1.r113a1.value = excelObj.ActiveCell.value
excelObj.ActiveCell.Offset(1, 0).Activate
form1.r113b1.value = excelObj.ActiveCell.value
excelObj.ActiveCell.Offset(1, 0).Activate
form1.r113c1.value = excelObj.ActiveCell.value
excelObj.ActiveCell.Offset(1, 0).Activate
form1.r113d1.value = excelObj.ActiveCell.value
excelObj.ActiveSheet.Cells(1, 1).Activate
excelObj.ActiveCell.Offset(5, Day(Now)+3).Activate
form1.r115a1.value = excelObj.ActiveCell.value
excelObj.ActiveCell.Offset(1, 0).Activate
form1.r115b1.value = excelObj.ActiveCell.value
excelObj.ActiveCell.Offset(1, 0).Activate
form1.r115c1.value = excelObj.ActiveCell.value
excelObj.ActiveCell.Offset(1, 0).Activate
form1.r115d1.value = excelObj.ActiveCell.value
excelObj.ActiveSheet.Cells(1, 1).Activate
excelObj.ActiveCell.Offset(9, Day(Now)+3).Activate
form1.r117a1.value = excelObj.ActiveCell.value
excelObj.ActiveCell.Offset(1, 0).Activate
form1.r117b1.value = excelObj.ActiveCell.value
excelObj.ActiveCell.Offset(1, 0).Activate
form1.r117c1.value = excelObj.ActiveCell.value
excelObj.ActiveCell.Offset(1, 0).Activate
form1.r117d1.value = excelObj.ActiveCell.value
excelObj.ActiveSheet.Cells(1, 1).Activate
excelObj.ActiveCell.Offset(13, Day(Now)+3).Activate
form1.r119a1.value = excelObj.ActiveCell.value
excelObj.ActiveCell.Offset(1, 0).Activate
form1.r119b1.value = excelObj.ActiveCell.value
excelObj.ActiveCell.Offset(1, 0).Activate
form1.r119c1.value = excelObj.ActiveCell.value
excelObj.ActiveCell.Offset(1, 0).Activate
form1.r119d1.value = excelObj.ActiveCell.value
excelObj.ActiveSheet.Cells(1, 1).Activate
excelObj.ActiveCell.Offset(17, Day(Now)+3).Activate
form1.r121a1.value = excelObj.ActiveCell.value
excelObj.ActiveCell.Offset(1, 0).Activate
form1.r121b1.value = excelObj.ActiveCell.value
excelObj.ActiveCell.Offset(1, 0).Activate
form1.r121c1.value = excelObj.ActiveCell.value
excelObj.ActiveCell.Offset(1, 0).Activate
form1.r121d1.value = excelObj.ActiveCell.value
'Close Workbook and Excel Object
excelObj.DisplayAlerts = False
excelObj.Workbooks.Close
set excelObj = nothing
end function
</SCRIPT>
<BODY onload="vbscript:getXls()">
<FORM name=form1>
<p align="right"><b><font size="5" color="#660066" face="Arial">test-
<script language = vbscript>
document.write Dateserial(year(now), month(now), day(now)) & " " & weekdayname(Weekday(day(now)+2))
</script>
</font></b></td>
<td width="199" bgcolor="#660066" height="19" style="border-left-style:none; border-right-style:solid; border-right-color:#660066; border-top-style:none; border-bottom-style:none">
<p align="left"><font color="#FFFFFF" face="Arial" size="2"><b>
<script language = vbscript>
document.write Dateserial(year(now), month(now), day(now)+1) & " " & weekdayname(Weekday(day(now)+3))
</script>
</b></font></td>
<td width="178" bgcolor="#660066" height="19" style="border-left-style:none; border-right-style:solid; border-right-color:#660066; border-top-style:none; border-bottom-style:none">
<p align="left"><font color="#FFFFFF" face="Arial" size="2"><b>
<script language = vbscript>
document.write Dateserial(year(now), month(now), day(now)+2) & " " & weekdayname(Weekday(day(now)+4))
</script>
</b></font></td>
<td width="178" bgcolor="#660066" height="19" style="border-left-style:none; border-right-style:solid; border-right-color:#660066; border-top-style:none; border-bottom-style:none">
<p align="left"><font color="#FFFFFF" face="Arial" size="2"><b>
<script language = vbscript>
document.write Dateserial(year(now), month(now), day(now)+3) & " " & weekdayname(Weekday(day(now)+5))
</script>
</b></font></td>
<td width="178" bgcolor="#660066" height="19" style="border-left-style:none; border-right-style:solid; border-right-color:#660066; border-top-style:none; border-bottom-style:none">
<p align="left"><font color="#FFFFFF" face="Arial" size="2"><b>
<script language = vbscript>
document.write Dateserial(year(now), month(now), day(now)+4) & " " & weekdayname(Weekday(day(now)+6))
</script>
</b></font></td>
</tr>
<tr>
<td width="128" bgcolor="#FFFF00" height="29" style="border-style: none; border-width: medium">
<font face="Arial" style="font-size: 9pt">Room 113</font></td> <td width="246" bgcolor="#FFFF00" height="29" style="border-style: none; border-width: medium" align="center">
<font face="Arial" style="font-size: 9pt">a</font></td>
<td width="150" style="border-left-style:none; border-right-style:solid; border-right-color:#660066; border-top-style:none; border-bottom-style:none" bgcolor="#FFFF00" height="29">
</td>
<td width="178" style="border-left-style:none; border-right-style:solid; border-right-color:#660066; border-top-style:none; border-bottom-style:none" height="29"> <font size="1"> <INPUT name=r113a size="27" style="border: 1px solid #FFFFFF;"></font></td>
<td width="199" style="border-left-style:none; border-right-style:solid; border-right-color:#660066; border-top-style:none; border-bottom-style:none" height="29"> <INPUT name=r113a1 size="27" style="border: 1px solid #FFFFFF;"></td>
<td width="178" style="border-left-style:none; border-right-style:solid; border-right-color:#660066; border-top-style:none; border-bottom-style:none" height="29"> <INPUT name=r113a2 size="27" style="border: 1px solid #FFFFFF;"></td>
</tr>
</table>
</FORM></BODY></HTML>