+ Reply to Thread
Results 1 to 4 of 4

Select/Edit Textbox within a Chart in Word Copied from Excel

  1. #1
    Registered User
    Join Date
    09-03-2019
    Location
    Oregon
    MS-Off Ver
    2010
    Posts
    2

    Question Select/Edit Textbox within a Chart in Word Copied from Excel

    Hello,
    I'm new to the forums and very new to VBA. I feel like I've been able to accomplish quite a bit through internet searches, but I've come across something that I just can't find an answer to. I have an excel sheet that gathers data and formats it into charts using several macros controlled by buttons. I then have a SendtoWord macro that opens a specific Word template, copies each of the 20 charts, finds the appropriate bookmark in the Word document, and pastes each chart into the correct location (all one chart at a time). The charts are 2 in. x 3.5 in. in Excel so that I can see several at a time on the screen, but they are larger in Word because they're meant to be printed for posting around the office. As each chart is pasted into Word, the macro selects it and changes the size of the chart itself as well as the data label, legend, and title font sizes. Then it moves onto the next chart.

    Here comes the problem... I've added a text box to each of the charts in Excel. The text within the boxes updates every time the charts update. If I run my SendtoWord macro, it still works great as far as what I described above. The new text boxes do copy over with the charts, but I can't figure out how to then grab the text box to change the font size like I have with the other items.

    Here's the code that I currently have for one chart for the above process:
    Please Login or Register  to view this content.
    Note: LineChartHeight, LineChartWidth, ChartDataFont, and ChartTitleFont are predefined integers that I've set with the sizes that I want for each item.

    I understand (or at least I guess) that it will be handled differently because the textbox isn't a native object of the chart. Somehow I need to select the textbox within the selected chart. I've tried using the ShapeRange, TextFrame, and TextRange objects in different combinations. I even tried using InlineShapes(2) thinking that it might be seen as a different shape within the selected range. Also, there are other text boxes in the Word template that I don't want to change, so I can't just do a blanket change to all text boxes in the document.

    Is anyone able to help me figure out how to edit a textbox within a chart in Word from Excel VBA?

    Thank you very much ahead of time.

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Select/Edit Textbox within a Chart in Word Copied from Excel

    Quote Originally Posted by Bryson White View Post
    I've added a text box to each of the charts in Excel.
    Can you better explain exactly how you added a textbox to a chart? Did you create an ActiveX Textbox and group it with the chart?

    Alternatively, instead of copying the chart to word, consider saving an image of the chart and then pasting the image in MSWord.

    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Registered User
    Join Date
    09-03-2019
    Location
    Oregon
    MS-Off Ver
    2010
    Posts
    2

    Re: Select/Edit Textbox within a Chart in Word Copied from Excel

    I just used Insert > Text Box. Should I use an ActiveX Textbox from the developer tab?

    I did consider the copy image option. Copying the chart as an image doesn't allow for individually changing the font sizes of the different parts of the chart. Also, it stretches and makes it hard to read when the size of the chart/picture itself is changed.

    Thanks!

  4. #4
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Select/Edit Textbox within a Chart in Word Copied from Excel

    I got nothing, BW. Sorry.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Edit chart size after copied from excel to PPTX file
    By hadoan in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-20-2019, 04:41 AM
  2. [SOLVED] How to select and edit value in listbox using textbox???
    By auswtz in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 12-13-2018, 03:50 AM
  3. [SOLVED] Copied excel table to Word, but need Word opening in landscape
    By jennis7242 in forum Excel Programming / VBA / Macros
    Replies: 20
    Last Post: 05-17-2018, 08:58 AM
  4. Replies: 1
    Last Post: 01-27-2014, 06:18 AM
  5. Select word in edit mode
    By johan111 in forum Excel General
    Replies: 0
    Last Post: 01-20-2014, 06:20 AM
  6. Using VBA, how do I get Excel to recognize/select an old Microsoft Graph Chart in Word?
    By RainbowGurl44 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-15-2013, 05:07 AM
  7. Textbox changes position on a copied excel-sheet
    By Hanspeter W. in forum Excel General
    Replies: 0
    Last Post: 07-01-2006, 04:45 PM

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1