CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2017

    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 offline Super Moderator Power Poster
    Join Date
    Dec 2012

    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. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. 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/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++17 Compiler: Microsoft VS2017 (15.7.3)

  3. #3
    Join Date
    Apr 2017

    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:

    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

On-Demand Webinars (sponsored)

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.