Total Pageviews

Monday, June 25, 2012

Convert excel to HTML and ftp upload second method

Start “Microsoft Visual Basic 2008 Express." Select the “File” menu, then click “New Project…” Click “Windows Forms Application” under “Visual Studio installed templates.” Select “OK."

Click “Project,” then select “Add Reference." Click “COM," select “Microsoft Excel 12.0 Object Library” and click “OK."

Imports Microsoft.Office.Interop

Public Class Form1
    Public status As String
    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        Dim excelApplication As New Excel.Application
        Dim excelWrkBook As Excel.Workbook
        excelApplication.Visible = False
        excelApplication.DisplayAlerts = False
        Dim theFile As String = "abc.xlsx"
        status = status & " Loading xlsx "
        excelWrkBook = excelApplication.Workbooks.Open("E:\webapp\ppm\upload\PPM\DAILYFLASH\" & theFile)
        Dim tempSourceFile As String = "E:\winapps\excel2htmlconverter\excel2htmlconverter\bin\Debug\htm\" & "dailycompile" & ".xls"
        status = status & " Converting to xls"

        excelWrkBook.SaveAs(tempSourceFile, _
        excelApplication.DisplayAlerts = True

        status = status & " Converting to HTML "
        'start upload
        FtpUploadFileToServer("", tempSourceFile, "/var/www/dp/ext/ppmmob/files/dailycompile/", , "admin", "admin&123", , True)

    End Sub

- Vinod Kotiya

No comments: