CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Threaded View

  1. #1
    Join Date
    Feb 2007
    Posts
    119

    Question About save method of Microsoft.Office.Interop.Excel.Workbook

    Sample code.

    Code:
    Microsoft.Office.Interop.Excel.Workbook theWorkbook =
    ExcelObj.Workbooks.Open(
    "C:\\test.xls", 0, true, 5,
    "", "", true, Excel.XlPlatform.xlWindows, "\t", false, false,
    0, true, null, null);
    Microsoft.Office.Interop.Excel.Sheets sheets = theWorkbook.Worksheets;
    Excel.Worksheet worksheet = (Excel.Worksheet)sheets.get_Item(1);
    Excel.Range rng1 = worksheet.get_Range("A1:A1", Type.Missing);
    rng1.Value2 = "TestVal";
    theWorkbook.Save();
    when save method is called a message is prompt "A file named 'test.xls' already exists in this location. Do you want to replace it?"
    I want to avoid that message, can anyone please help me how to do that.


    Thanks,
    Mushq
    Last edited by HanneSThEGreaT; June 12th, 2008 at 04:22 AM.

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

Featured