Extract specific data from excel file and mail via outlook 2007
I am new to C#. Please help me with my problem!
I have an Excel file in which multiple sheets are present. From "Sheet1", I have to look for a character "d" in column "M". If "d" is present in some cells of column "M", then I have to mail the row contents (cells A-H) where the character is found to a mail address with the contents extracted through Microsoft Outlook 2007.
Re: Extract specific data from excel file and mail via outlook 2007
[Thread moved to c# forum]
Re: Extract specific data from excel file and mail via outlook 2007
I have implemented my work using VBA (macros). I want to convert my VBA code to C#. I want help in converting my code to C#.
My implementation so far is as under:
Code:
Option Explicit
Sub CopyRow()
Dim i As Integer
Dim lRow As Long, nextRow As Long
lRow = Sheets("Document List").Cells(Rows.Count, "M").End(xlUp).Row
For i = 1 To lRow
If InStr(1, LCase(Range("M" & i)), "d") <> 0 Then
nextRow = Sheets("Sheet1").Range("A" & Rows.Count).End(xlUp).Row + 1
Range("A" & i & ":H" & i).Copy Destination:=Sheets("Sheet1").Range("A" & nextRow)
End If
Next i
End Sub