Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7890551
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T06:23:01+00:00 2026-06-03T06:23:01+00:00

Question in short : this line: doc.InlineShapes.AddOLEObject(Excel.Chart.8); // doc is a Microsoft.Office.Interop.Word.Document object opens

  • 0

Question in short :

this line:

doc.InlineShapes.AddOLEObject("Excel.Chart.8"); // doc is a Microsoft.Office.Interop.Word.Document object

opens Excel. How to disable this?


more details:

I am trying to create docx documents from a template with scripting Word2010 in c#.
I open a document this way:

Word.Document doc = app.Documents.Open(@"xxxx.docx",Visible:false);

During the script, Word2010 does not appear, but Excel2010 does, when I create a chart inside the word document (“Excel.Chart.8”)

I see the whole chart scripting process on my monitor, which is not what I want.

Is there any way to hide Excel2010 (Chart Tools) during the process?

edit: An example of creating an excel chart:

Microsoft.Office.Interop.Word.Application app = new Microsoft.Office.Interop.Word.Application();
Word.Document doc = app.Documents.Open(@"xxxx.docx",Visible:false);
string classtype = "Excel.Chart.8";
Bookmark shapeBookMark = doc.Bookmarks.get_Item("mybookmark");
Word.InlineShape wrdInlineShape = doc.InlineShapes.AddOLEObject(classtype, Range: shapeBookMark.Range);
if (wrdInlineShape.OLEFormat.ProgID == classtype)
      {
         object verb = Word.WdOLEVerb.wdOLEVerbHide;
         wrdInlineShape.OLEFormat.DoVerb(ref verb);
         Excel.Workbook obook = (Excel.Workbook)wrdInlineShape.OLEFormat.Object;
         Excel.Worksheet sheet = (Excel.Worksheet)obook.Worksheets["Sheet1"];
         //then the access of a cell goes like this:
         ((Microsoft.Office.Interop.Excel.Range)sheet.Cells[1, 1]).Value = "data";
      }

Notice that Visible:false parameter must be used, because otherwise both excel and word will appear on a long scripting process. On a short one, it will not appear, but I need to do long scripting processes (creating, filling and formatting 16 charts/docx)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T06:23:02+00:00Added an answer on June 3, 2026 at 6:23 am

    I can recreate this on my machine, although I’m using Office 2007 rather than 2010. The only semi-solution I’ve managed to find so far is to get the active instance of Excel and switch it to invisible. Excel will flash up for a second and then disappear, but at least it will not remain visible while you perform your scripting/charting.

    So inserting this into your code:

    Word.InlineShape wrdInlineShape = doc.InlineShapes.AddOLEObject(classtype, Range: shapeBookMark.Range);
    Excel.Application xlApp = (Excel.Application)Marshal.GetActiveObject("Excel.Application");
    xlApp.Visible = false;
    
    if (wrdInlineShape.OLEFormat.ProgID == classtype)
    {
        // etc...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a short question. At some point my thread understand that it should
I feel rather foolish as this is just a short question. I was reading
I have a short question. I want do put this \tssr>&\8=f23' into a String
This question will be short and sweet. I know an instruction can occur between
The short version of the question - why can't I do this? I'm restricted
This is basically a rails 3 version of this question . Short of parsing
So to make a long story short. A professor asked this question in class
This question is a continuation of this thread : In short: To solve my
I didn’t found short form for this question as subject… Is it possible to
This is a follow-up to my last question. Thanks to mu is too short

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.