maandag 14 december 2009

How To: 'Reverse engineer a .net application?'

With Reflector you can revert the CIL to .net code with the help of an reflector add-in by Denis Bauer: http://www.denisbauer.com/NETTools/FileDisassembler.aspx

This add-in allows you to generate a .net project.
Only a designer file isn't generated. The Designer code is merged in the code-behind form class file.

Save XLS File to CSV File (VB.net)

Private Sub SaveExcelFileAsCVSFile()

Dim excelfile As Microsoft.Office.Interop.Excel.Application =
New Microsoft.Office.Interop.Excel.Application
Dim sFileName As String
Dim wb As Workbook = excelfile.Workbooks.Open( _
"FILE.xls", CorruptLoad:=XlCorruptLoad.xlRepairFile)
sFileName = wb.Path & "\FILE.csv"
wb.SaveAs(sFileName, XlFileFormat.xlCSV, XlSaveAsAccessMode.xlNoChange)
wb.Close()
excelfile.Quit()

End Sub

Export excel file to csv (VBA Macro)

Set Separator (;)


Sub SaveToCSVFile()

Dim fs As Object, a As Object, i As Integer, j As Integer, s As String, t As String, l As String, mn As String
Set fs = CreateObject("Scripting.FileSystemObject")
Dim newFileName As String
newFileName = ThisWorkbook.FullName
newFileName = Replace(newFileName, ".xls", ".csv")
Set a = fs.CreateTextFile(newFileName, True)
Range("A1").Select
i = ActiveCell.CurrentRegion.Columns.Count
ActiveCell.CurrentRegion.EntireRow.Delete


For rowNumber = 1 To Range("A65536").End(xlUp).Row
s = ""
Col = 1
For j = 0 To i
s = s & Cells(rowNumber, Col) & ";" 'Separator
Col = Col + 1
Next j
a.writeline s 'write line
Next rowNumber

End Sub