View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
ste mac ste mac is offline
external usenet poster
 
Posts: 117
Default Excel data to a web page

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, " <titleBall 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, " <CENTERBall 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