VERSION 5.00 Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX" Begin VB.Form frmConv BorderStyle = 1 'Fixed Single Caption = "Convert xlsToHtml" ClientHeight = 1320 ClientLeft = 45 ClientTop = 330 ClientWidth = 5205 LinkTopic = "Form1" MaxButton = 0 'False MinButton = 0 'False Picture = "frmConv.frx":0000 ScaleHeight = 1320 ScaleWidth = 5205 StartUpPosition = 2 'CenterScreen Begin VB.CommandButton cmdConvert Caption = "&Convert" Height = 360 Left = 3585 TabIndex = 4 Top = 900 Width = 1590 End Begin VB.TextBox txtRange Height = 315 Left = 1770 TabIndex = 3 Text = "A1:B2" Top = 525 Width = 3390 End Begin MSComDlg.CommonDialog CDiag Left = 2850 Top = 2115 _ExtentX = 847 _ExtentY = 847 _Version = 393216 End Begin VB.CommandButton Command1 Caption = "&Save as..." Height = 360 Index = 1 Left = 1785 TabIndex = 1 Top = 90 Width = 1590 End Begin VB.CommandButton Command1 Caption = "&XLS source..." Height = 360 Index = 0 Left = 120 TabIndex = 0 Top = 90 Width = 1590 End Begin VB.Label Label1 Appearance = 0 'Flat AutoSize = -1 'True BackColor = &H80000005& BackStyle = 0 'Transparent Caption = "&Type a valid range:" ForeColor = &H80000008& Height = 195 Left = 90 TabIndex = 2 Top = 600 Width = 1365 End End Attribute VB_Name = "frmConv" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Option Explicit ' Set a reference to Microsoft Excel object library ' throghout Menu project, references... Dim XLSFile As String Dim HTMLFile As String Dim xlApp As Excel.Application Dim wb As Excel.Workbook Dim sh As Excel.Worksheet Sub ConvertXLSToHtml(XFilename As String, HFilename As String, ValRng As String) ' This routine could be modify to create a more ' nice web page. ' For sake of simplicity and performance, ' i let it just plain. Set xlApp = New Excel.Application Set wb = xlApp.Workbooks.Open(XFilename) Set sh = wb.ActiveSheet Dim rng As Range Set rng = sh.Range(ValRng) xlApp.Visible = True Dim ff As Integer ff = FreeFile Open HFilename For Output As #ff Dim Cell As Range Dim iCols As Integer, iRows As Integer iCols = rng.Columns.Count iRows = rng.Rows.Count Dim ir As Integer, ic As Integer Print #ff, "
| " & rng.Cells(ir, ic).Value & " | " ElseIf IsEmpty(rng.Cells(ir, ic).Value) Then Print #ff, "" & " " & " | " Else Print #ff, "" & rng.Cells(ir, ic).Value & " | " End If Next ic Print #ff, "