Excel data to a web page

  • Thread starter Thread starter ffcyan
  • Start date Start date
F

ffcyan

I need a VB Script or Java Script that allows one to take select dat
(i.e. Range("A1")) from a specific Excel worksheet and place it into
web page. Thank you
 
Hi ffcyan, a mate wrote this code, it works for me...it puts all the
information in a table in a web page...


Const FileName = "C:\My Program\yourplace\All Web
Pages\sheetname.htm"

Dim xlRow As Long
Dim xlCol As Long


Public Sub BallSumsHTML()

Open FileName For Output As #1

Print #1, "<HTML>"

' Code below commented out as it is only applicable if you are
using a stylesheet
' in the web site to control layout etc.,

Print #1, " <HEAD>"
Print #1, " <title>Ball Sums</title>"

'Print #1, " <BASE TARGET='MainForm'>"
'Print #1, " <META http-equiv='Content-Style-Type'
content='Text/css'>"
'Print #1, " <LINK type='text/css' rel='stylesheet'
href='lottery.css'>"

Print #1, " </HEAD>"
Print #1, " <BODY>"
Print #1, " <H1>"
Print #1, " <CENTER>Ball Sums</CENTER>"
Print #1, " </H1>"
Print #1, " <P>"
Print #1, "The table below shows you the ball sums."
Print #1, "<P align = center>"
Print #1, " <table border='8'>"
Print #1, " <tr>"


' This next piece of code reads the xlsheet header information and
builds the
' HTML table header.

For xlCol = 1 To 3

Print #1, " <td align='center'bgcolor='; #fcfcfc; '>" &
Sheets("sheet3").Cells(1, xlCol).Value & "</td>"

Next

Print #1, " </tr>"

' This next piece of code reads the xlsheet information and moves
the
' game data into the HTML table.

xlRow = 2

Do While Not Sheets("sheet3").Cells(xlRow, 1).Value = ""
Print #1, " <tr>"

For xlCol = 1 To 3

If Val(Sheets("sheet3").Cells(xlRow, xlCol).Value) < 0 Then

Print #1, " <td align='center'bgcolor = '#cdcccc'>" &
Sheets("sheet3").Cells(xlRow, xlCol).Value & "</td>"

Else

Print #1, " <td align='center'>" &
Sheets("sheet3").Cells(xlRow, xlCol).Value & "</td>"

End If
Next

xlRow = xlRow + 1

Loop

Print #1, " </tr>"
Print #1, " </TABLE>"
Print #1, " <a href = 'menu.htm'> go to menu</a>"
Print #1, " </BODY>"
Print #1, "</HTML>"

Close #1

End Sub

hth..

seeya ste
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top