How to hide Excel When processing a Word.Chart In Word

Discussion in 'Word Programming' started by liu_jz@yahoo.com, Nov 16, 2012.

  1. Guest

    Dear experts,

    I hope to creat charts in Microsoft Word. I know Microsoft Office 2007
    SP2 and Office 2010 provide the new object model Wor.Chart. Everything
    is good except the Microsoft Excel always appears. The Microsoft Excel
    will appear when I run ChartData.Activate. I just can hide the
    Microsoft Excel after this step. Is there any way to hide Microsoft
    Excel during the whole processing?

    The code:

    Dim wdApplication As Microsoft.Office.Interop.Word.Application =
    Nothing
    Dim wdDocument As Microsoft.Office.Interop.Word.Document = Nothing
    Dim wdChart As Microsoft.Office.Interop.Word.Chart = Nothing
    Dim xlWorkbook As Microsoft.Office.Interop.Excel.Workbook = Nothing

    ......
    wdChart = wdDocument.InlineShapes(1).Chart
    With wdChart.ChartData
    .Activate() ' Microsoft Excel will appear. This is the problem.
    xlWorkbook = .Workbook
    End With
    If xlWorkbook Is Nothing Then
    Exit Function
    End If
    With xlWorkbook.Application
    .Visible = False ' Hide Microsoft Excel
    .ScreenUpdating = False
    ' Put data into Worksheets
    ......
    wdChart.Refresh()
    .Quit()
    End With

    Regards,
    Liu Jianzhong
     
    , Nov 16, 2012
    #1
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Frankie Yung

    Hide/Show paragraph

    Frankie Yung, Oct 17, 2006, in forum: Word Programming
    Replies:
    1
    Views:
    97
    Jean-Guy Marcil
    Oct 17, 2006
  2. Jonas Pedersen

    Word automation print, hide error messages

    Jonas Pedersen, Oct 30, 2006, in forum: Word Programming
    Replies:
    1
    Views:
    76
    Jonathan West
    Oct 30, 2006
  3. Replies:
    18
    Views:
    186
    Howard Kaikow
    Feb 6, 2007
  4. Manuel Murieta

    Automatically hide rows when printing

    Manuel Murieta, Apr 24, 2007, in forum: Word Programming
    Replies:
    1
    Views:
    90
    Jonathan West
    Apr 24, 2007
  5. Emilio
    Replies:
    0
    Views:
    95
    Emilio
    Mar 18, 2008
  6. Hide Rows in Table

    , May 14, 2008, in forum: Word Programming
    Replies:
    3
    Views:
    84
    Jean-Guy Marcil
    May 14, 2008
  7. Jack
    Replies:
    5
    Views:
    132
    Jean-Guy Marcil
    Dec 10, 2008
  8. Bshawn

    Hide OptionButtons in a word document

    Bshawn, Aug 21, 2009, in forum: Word Programming
    Replies:
    10
    Views:
    127
    Jay Freedman
    Aug 25, 2009
Loading...