If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > Distribute Excel Graphs without the underlying data.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-28-07, 12:43
JerryDal JerryDal is offline
Registered User
 
Join Date: Jan 2002
Location: Bay Area
Posts: 473
Question Distribute Excel Graphs without the underlying data.

In a workbook with graphs, when I select all cells and copy and paste as values, the data in the graphs are still referencing data in the external workbook. The graphs are to be distributed monthly in Excel and PDF. How do I change the graphs on the distribution copy so that they are not dependent on the workbook with the source data? Excel version is 2003.
Thanks.
Jerry
Reply With Quote
  #2 (permalink)  
Old 11-29-07, 09:21
shades shades is offline
Registered User
 
Join Date: Oct 2003
Posts: 1,091
Howdy. I have found the easiest way to do that is to use VBA code and put it into Powerpoint as a linked picture. Then you can break the links in PPT, and re-paste into Excel. This reduces the file size considerably. My reason is that here, everything has to be presented in PPT. Note that this copies the range. What I do is select the cells under and around the graph and include that. Actually I put the entire graph in one cell, and use the cell above for title formatting, and the cell below for legend, etc. This allows much greater flexibility for formatting and colors. Of course, you will have to expand the size of the cell, normally I use 60 wide and 150 high. Then when resizing the graph, hold down the OPTION key which forces it to snap to the cell's edge. Also, when selecting the chart, to Format, go to the tab for font and uncheck the box in lower left that says "Auto Scale", and set the font size to whatever you want (8 pt works best). Then I also use no fill and no borders on the graph.

If you want I can post a small sample to look at.

Jon Peltier provided the initial code:

Code:
'=======================================
' Program: RangeToPPTLink
' Description: Copies selected range as a picture, pastes into Powerpoint as linked picture
' Called by: Toolbar button "Rng Link"
' Changes-----------------------------------------------------------
' Date         Programmer     Change
'                   Jon Peltier           Original
'=======================================

Sub RangeToPPTLink()
' Set a VBE reference to Microsoft PowerPoint Object Library for Office,
' Adapted from http://peltiertech.com/Excel/XL_PPT.html

Dim PPApp As PowerPoint.Application

Dim PPPres As PowerPoint.Presentation
Dim PPSlide As PowerPoint.Slide

' Make sure a range is selected
If Not TypeName(Selection) = "Range" Then
    MsgBox "Please select a worksheet range and try again.", vbExclamation, _
        "No Range Selected"
Else
    Set PPApp = GetObject(, "Powerpoint.Application")
    ' Reference active presentation
    Set PPPres = PPApp.ActivePresentation
    PPApp.ActiveWindow.ViewType = ppViewSlide
    ' Reference active slide
    Set PPSlide = PPPres.Slides(PPApp.ActiveWindow.Selection.SlideRange.SlideIndex)
    
    ' Copy the range as a picture
    Selection.Copy

    ' Paste the range
    PPSlide.Shapes.PasteSpecial(Link:=True).Select
    
    ' Align the pasted range
'    PPApp.ActiveWindow.Selection.ShapeRange.Align msoAlignCenters, True
'    PPApp.ActiveWindow.Selection.ShapeRange.Align msoAlignMiddles, True

    ' Clean up
    Set PPSlide = Nothing
    Set PPPres = Nothing
    Set PPApp = Nothing
End If

End Sub
__________________
old, slow, and confused
but at least I'm inconsistent!

Rich
(retired Excel 2003 user, 3/28/2008)

How to ask a question on forums
Reply With Quote
  #3 (permalink)  
Old 11-29-07, 12:03
JerryDal JerryDal is offline
Registered User
 
Join Date: Jan 2002
Location: Bay Area
Posts: 473
I checked the VBE reference to MS PowerPoint 11.0 Object Library. Others already checked are Visual Basic for Applications, Microsoft Excel 11.0 Object Library, OLE Automation, and Microsoft Office 11.0 Object Library. I selected a range and ran the code which halted at the line of code "Set PPApp = GetObject(, PowerPoint.Application"). The error message was "ActiveX component can't create object". I closed Excel and tried again with the same results. My PowerPoint executable is spelled "POWERPNT.EXE", but changing the spelling in the code to "PowerPnt" made no difference.
You may not be able to advise me on this, but I am hoping this is an easy fix.
Thanks.
Jerry
Reply With Quote
  #4 (permalink)  
Old 11-29-07, 16:18
shades shades is offline
Registered User
 
Join Date: Oct 2003
Posts: 1,091
Hmmm. I am using Excel 2003 and it works fine for me. I wonder if it needs the Scripting Runtime to be referenced as well (I have it checked in my References).

Did you open Powerpoint prior to running the code? The way it is written, Powerpoint needs to be open to a slide.
__________________
old, slow, and confused
but at least I'm inconsistent!

Rich
(retired Excel 2003 user, 3/28/2008)

How to ask a question on forums
Reply With Quote
  #5 (permalink)  
Old 11-29-07, 17:13
JerryDal JerryDal is offline
Registered User
 
Join Date: Jan 2002
Location: Bay Area
Posts: 473
Thumbs up

The Excel VBA code worked with PowerPoint open. Thanks.
Problem solved.
Jerry
Reply With Quote
  #6 (permalink)  
Old 11-29-07, 21:48
shades shades is offline
Registered User
 
Join Date: Oct 2003
Posts: 1,091
Great. There is code available somewhere that opens PPT. But I found that I am working on the project in both Excel and PPT, so it will always be open.
__________________
old, slow, and confused
but at least I'm inconsistent!

Rich
(retired Excel 2003 user, 3/28/2008)

How to ask a question on forums
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On