Extract specific data from excel file and mail via outlook 2007
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Extract specific data from excel file and mail via outlook 2007

  1. #1
    Join Date
    Apr 2017
    Posts
    7

    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.

  2. #2
    2kaud's Avatar
    2kaud is online now Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    5,718

    Re: Extract specific data from excel file and mail via outlook 2007

    [Thread moved to c# forum]
    All advice is offered in good faith only. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/

    C++17 Compiler: Microsoft VS2017 (15.3.4)

  3. #3
    Join Date
    Apr 2017
    Posts
    7

    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
    Last edited by 2kaud; April 14th, 2017 at 02:47 AM. Reason: Added code tags

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This a Codeguru.com survey!


On-Demand Webinars (sponsored)