Problem in calling Excel Run fucntion from VC++
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8

Thread: Problem in calling Excel Run fucntion from VC++

  1. #1
    Join Date
    Oct 2009
    Posts
    26

    Problem in calling Excel Run fucntion from VC++

    Hi,
    i have a problem in calling excel Fourier analysis functions from vc++.

    the below line gives a error while running.
    the error rises in excel sheet.

    Code:
        mp_application->Run("ATPVBAEN.XLA!Fourier",
                            (const variant_t)p_work_sheet->GetRange(p_range_pointer->Item[dw_dest_row1][dw_dest_col1],p_range_pointer->Item[dw_dest_row1][dw_dest_col1]),
                            (const variant_t)p_work_sheet->GetRange(p_range_pointer->Item[dw_dest_row1][dw_dest_col1],p_range_pointer->Item[dw_dest_row1][dw_dest_col1]),
                            false,false);
    
     ERROR is : fourier analysis - input range must be contagious reference.
    mp_application is a Excel::_ApplicationPtr
    p_work_sheet is a Excel::_WorksheetPtr


    please help me in finding out, what mistake i am doing while sending the parameters.
    help is highly applicable.
    thanks in advance.

    - satya.

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,611

    Re: Problem in calling Excel Run fucntion from VC++

    Quote Originally Posted by lion.king View Post
    ERROR is : fourier analysis - input range must be contagious reference.
    ...
    please help me in finding out, what mistake i am doing while sending the parameters.
    "contagious" or "contigious"?
    If the latter - then http://www.google.com/search?hl=en&r...&aq=f&oq=&aqi=
    Victor Nijegorodov

  3. #3
    Join Date
    Oct 2009
    Posts
    26

    Re: Problem in calling Excel Run fucntion from VC++

    Quote Originally Posted by VictorN View Post
    "contagious" or "contigious"?
    If the latter - then http://www.google.com/search?hl=en&r...&aq=f&oq=&aqi=
    it is contigious .. i searched in Google...they show code which is written or generated from macro recorder. but my code is in VC++. it has some thing to do with parametres ..which it is not able to match..


  4. #4
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,611

    Re: Problem in calling Excel Run fucntion from VC++

    The first link ( http://www.mrexcel.com/forum/showthread.php?t=35738 ) from the Google Search I referred to in my previous post explains you very clear the most possible reason of this message:
    This means that the selection must be a single cell or the selection must be a rectangular area, not multiple unconnected areas
    Victor Nijegorodov

  5. #5
    Join Date
    Oct 2009
    Posts
    26

    Re: Problem in calling Excel Run fucntion from VC++

    Quote Originally Posted by VictorN View Post
    The first link ( http://www.mrexcel.com/forum/showthread.php?t=35738 ) from the Google Search I referred to in my previous post explains you very clear the most possible reason of this message:
    reply is highly appreciated. i got what it is saying. but i am not able to understand why it is giving the error even if i send the contiguous area.

  6. #6
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,611

    Re: Problem in calling Excel Run fucntion from VC++

    Quote Originally Posted by lion.king View Post
    reply is highly appreciated. i got what it is saying. but i am not able to understand why it is giving the error even if i send the contiguous area.
    Perhaps, it is NOT contiguous enough?
    The code snippet you have posted doesn't show how "contiguous" this area is!
    Victor Nijegorodov

  7. #7
    Join Date
    Oct 2002
    Location
    Austria
    Posts
    1,284

    Re: Problem in calling Excel Run fucntion from VC++

    Code:
    (const variant_t)p_work_sheet->GetRange(p_range_pointer->Item[dw_dest_row1][dw_dest_col1],p_range_pointer->Item[dw_dest_row1][dw_dest_col1]),
    (const variant_t)p_work_sheet->GetRange(p_range_pointer->Item[dw_dest_row1][dw_dest_col1],p_range_pointer->Item[dw_dest_row1][dw_dest_col1]),
    This doesn't look like a range to me, more like a single cell.
    fourier analysis doesn't work well with only one value.

    Kurt

  8. #8
    Join Date
    Oct 2009
    Posts
    26

    Re: Problem in calling Excel Run fucntion from VC++

    Quote Originally Posted by ZuK View Post
    This doesn't look like a range to me, more like a single cell.
    fourier analysis doesn't work well with only one value.
    getrange function converts the given col and row number to range pointers. so i think i am passing range pointer only.

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 is a CodeGuru survey question.


Featured


HTML5 Development Center