Consulting

Results 1 to 4 of 4

Thread: Pasting charts in the same document - avoiding new instance creation

  1. #1

    Pasting charts in the same document - avoiding new instance creation

    Hi,

    I am having a problem and I don't even know where to begin with that project. I have a sheet in with I have a chart. A VBA program sets an instance of word and then copy this chart at a specific bookmark inside a word template. Then the chart changes (I mean when the chart is copied and pasted, new data comes in - I do what I need to do and copy and paste again). What I need is a way to send this to the same sheet as the previous one (to a different bookmark). As you might be aware, when you open a template, a copy of the document is open (with a different name). At the moment, everything works as planned but the program keeps opening new documents for each new chart. I assume I have to look if an instance exist before I create or open a new one but I am not quite sure where to put it in the code and how to do it generally. Anyone done that before?

  2. #2
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    You could use the Dir command to look for a file name. If found, open the file and insert the chart. If not found, create a new document from the template.
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  3. #3
    I am sorry but for this one I am totally clueless as how it would like.
    Can you give me an idea of how the "if" line would look like?
    Thanks for yout input

  4. #4
    Administrator
    VP-Knowledge Base VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Can you post the code you have?
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

Posting Permissions

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