Wednesday, November 19, 2008

Import from excel

xlFilePath = workspace.OpenFileDialog( False, "Please select the excel file ","*.xls", "d:")

If Isempty(xlFilePath) Then

Exit Sub

End If
Set varExcel = CreateObject( "Excel.Application" )

varExcel.Visible = False ' Making the selected Excel invisible

varExcel.Workbooks.Open xlFilePath '// Open the Excel file

Set xlWorkbook = varExcel.ActiveWorkbook

Set xlSheet = xlWorkbook.ActiveSheet

intExcelRow= 2 ' The excel file content starts from 2 always
'Processing the Excel row and sending an email

Print "Upload process started......."

While (xlSheet.cells(intExcelRow, 1).value <> "" )

With xlSheet

strExcelRepID = Cstr (.Cells( intExcelRow, 1).Value) '

strExcelFilename = Cstr (.Cells( intExcelRow, 2).Value)

End With

intExcelRow = intExcelRow +1

Print "Row Number -- " + Cstr (intExcelRow)

Wend

1 comment:

Suresh said...

ரொம்ப நல்லா எழுதுறிங்க தொடர்ந்து எழுதுங்கள்