Results 1 to 3 of 3

Thread: Cannot convert from 'string' to 'ref object' ?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Oct 2006
    Posts
    24

    Cannot convert from 'string' to 'ref object' ?

    Hi to everybody

    I have a method like this

    public bool stduy(string filename)
    {
    int max = 500;
    Word.ApplicationClass wordApp = new Word.ApplicationClass();
    object file = filename;
    object readOnly = false;
    object isVisible = false;
    object miss = System.Reflection.Missing.Value;
    Word.Document doc = wordApp.Documents.Open(filename, ref miss,ref readOnly, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref isVisible);
    Word.WdStatistic countedWords = Word.WdStatistic.wdStatisticWords;

    int num = doc.ComputeStatistics(countedWords, ref miss);
    if (num > max)
    {
    return false;
    }
    else
    {
    return true;
    }
    }

    and when i build it, says Cannot convert from 'string' to 'ref object' , so where might i have made a mistake?

    Thanks

  2. #2
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Cannot convert from 'string' to 'ref object' ?

    Please use the [code][/code] tags.

    You've passed filename instead of ref file in the first parameter of the call to Word.Documents.Open.

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Oct 2006
    Posts
    24

    Re: Cannot convert from 'string' to 'ref object' ?

    Sorry i forgot to use tags. And thanks for the help

Posting Permissions

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



Click Here to Expand Forum to Full Width