object.Open PathName[, OpenAs ][, ReadOnly]ParametersobjectAn expression that evaluates to a Documents object.PathNameA String that specifies the full path to the document.OpenAs(Optional) A Variant that is a String specifying the document type when the document opens. Possible values are: "Text"   Opens the document as a text file.
"Auto"   Opens the document in the default editor (the default). 
ReadOnly(Optional) A Variant that is a Boolean specifying whether the document is read-only. Possible values are: True   Opens as read-only.
False   Opens as read/write (the default). 
ExampleThe following example opens the macro file C:\ Program Files\Microsoft Visual Studio\Common\MSDEV98\Macros\Sample.dsm as read-only:

解决方案 »

  1.   

    thank you ,ishallwin 
    but what I want is that  format , i want is this format below 
    //////////////////////LPDISPATCH Documents::Open(VARIANT* FileName, VARIANT*onfirmConversions,       VARIANT* ReadOnly, VARIANT* AddToRecentFiles, 
    VARIANT* PasswordDocument,  VARIANT* PasswordTemplate,
    VARIANT* Revert, VARIANT* WritePasswordDocument, 
    VARIANT* WritePasswordTemplate, VARIANT* Format,
    VARIANT* Encoding, VARIANT* Visible)///////////////////////////
    shall you introduce this format for me  
    if you shall ,i am ever so much 
    you are a good man
      

  2.   

    The opition argument should use 
    COleVariant vOpt(DISP_E_PARAMNOTFOUND, VT_ERROR) not varNull as you used. 
    also u can use:      VARIANT varOpt;
          varOpt.vt = VT_ERROR;
          varOpt.scode = DISP_E_PARAMNOTFOUND;
      

  3.   

    check msdn type keywords kbword
      

  4.   

    我以前也写过类似的程序,也遇到过这样的问题,办法之一是自己重写一个
    只要一个参数的Open函数。
    加入你自己的程序就可以了
    程序如下:
    在Documents中加入:LPDISPATCH Documents::Open(VARIANT* FileName)
    {
    LPDISPATCH result;
    static BYTE parms[] = VTS_PVARIANT;
    InvokeHelper(0xc, DISPATCH_METHOD, VT_DISPATCH, (void*)&result, parms, FileName);
    return result;
    } 在程序中调用即可: m_docTest= m_docs.Open(COleVariant("f:\\test.doc"));
      

  5.   

    thank you all
    you give me much help ,now let me say thank you all again
    but there are  two question 
    first:  VARIANT*  Format   ---how use it and its meaning?
    second: VARIANT*  Visible  ---how use it and its meaning?oh ,there is a error in that statement  below
    myDoc.Close(  &varTrue,  &varDocName,  &varNull);  
    error:类型不匹配
    please change the error for me ,thanks