Graphic 3 for SigmaPlot

Keywords: SigmaPlot Download, sigmaplot, download, SigmaPlot, Download

Using Macros to Place SigmaPlot Charts in Microsoft Products

This macro requires that you install the "well plate data.xls" file in your SigmaPlot directory. The path to this directory will be similar to

C:\Program Files\SigmaPlot\SPW7

but you can easily find this path by using the Search or Find feature in your Start menu and searching for "Spw.exe"

This macro

  1. imports data from an Excel well plate file
  2. creates a graph using the X, Y Replicate row replicate format
  3. copies the graph in SigmaPlot and pastes it to a PowerPoint slide.

The macro statements for importing data and creating the graph were created with the macro recorder. One statement was then modified to allow the Excel graph to be found on all computer installations. The macro statements were then added which open PowerPoint (if necessary), add a slide and paste the graph.

SigmaPlot includes a macro Paste to PowerPoint Slide. This is much more sophisticated than what is presented here. This presentation is tutorial in nature and shows the smallest amount of macro code required to paste a graph into PowerPoint.

Recording File Import and Graph Creation

The steps used to record the well plate file import and graph creation are outlined below. It is useful to see how easy it is to record the file import and select a region of the well plate worksheet to be graphed. If you want you can view the graphics below which show the important steps in the recording process and skip to the section on Adding PowerPoint Automation Statements. Working versions of all macros discussed here are contained in the Graph to PowerPoint Macro SigmaPlot notebook for you to use.

SigmaPlot Download gr1

  1. Select Tools, Macro, Record New Macro from the main menu
  2. Select File, New, Notebook, OK
  3. Select File, Import... and locate the "well plate data.xls" file that you placed in your SigmaPlot directory.
  4. Click on this file to select it and click Import.
  5. Click Import again to import the entire Excel worksheet
  6. Highlight the well plate data showing replicates across rows for different inhibitor concentrations down columns (the log concentration data in column 2 has been artificially added to this worksheet for presentation simplicity).

    SigmaPlot Download gr2

  7. Select the Line/Scatter Plot icon and then click the Simple Line & Scatter - Error Bars sub icon. The first dialog of the Graph Wizard appears.
  8. Select Row Means for the Symbol Value and leave Standard Deviation as the Upper and Lower error bar calculation.

    SigmaPlot Download gr3
  9. Click Next. Make sure X,Y Replicate is selected and click Next again.
  10. Click Finish.
  11. Click the Stop Recording button on the small macro recording dialog and enter the macro name "Graph from Excel File." Click OK.
  12. This macro will be saved in the SigmaPlot Macro Library.jnb notebook when you exit SigmaPlot and respond Yes to the prompt.

The macro "Graph from Excel File" has been created. It will import data from an Excel file, select the data region of the worksheet and create the following graph.

SigmaPlot Download gr4

A copy of this recorded macro is included in the SigmaPlot notebook Graph to PowerPoint.jnb. You may run it by double clicking on the Graph from Excel File macro icon in this notebook and selecting Run from the Macros dialog.

Adding PowerPoint Automation Statements

To paste the graph to a PowerPoint slide, PowerPoint automation statements must be added to the macro. Double click the macro Graph to PowerPoint in the SigmaPlot notebook Graph to PowerPoint.jnb and select Edit. The macro with the additional PowerPoint statements is displayed.

We use some of the PowerPoint constants (e.g., ppLayoutBlank to create a blank slide) and, in order to do this, we need to select the PowerPoint Macro Reference. Click the Macro References button In the SigmaPlot macro editor.

SigmaPlot Download gr5

Find and select the Microsoft PowerPoint Object Library and click OK.

SigmaPlot Download gr6

Save the SigmaPlot macro to save this reference for this macro.

The first two statements are SigmaPlot automation statements that select the graph and copy it to the clipboard.

'copy SigmaPlot graph
ActiveDocument.CurrentPageItem.SelectAll         'select everything on pageActiveDocument.CurrentPageItem.Copy        'copy selection to clipboard

The next group of statements defines PPApp as a PowerPoint object in SigmaPlot and then starts PowerPoint if it is not already open.

'start PowerPoint
Dim PPApp As Object
Set PPApp=CreateObject("PowerPoint.Application")  'create PowerPoint application object
PPApp.Visible=True                                 'start PowerPoint (if its not already running)

The Add method is first used to create a new PowerPoint presentation and then to add a blank slide to this presentation. The ppViewSlide and ppWindowMaximized constants are used to change to the Slide View and maximize it.

'set up PowerPoint window and slide layout
PPApp.Presentations.Add                            'create a new presentation
PPApp.ActivePresentation.Slides.Add PPApp.ActivePresentation.Slides.Count+1, ppLayoutBlank
PPApp.ActiveWindow.ViewType = ppViewSlide         'change from Normal View to Slide View
PPApp.ActiveWindow.WindowState = ppWindowMaximized  'maximize Slide View window

The contents of the clipboard (a SigmaPlot graph) are then pasted into the slide view. System resources are then released by terminating the PowerPoint application.

'paste SigmaPlot graph to PowerPoint slide
PPApp.ActiveWindow.View.Paste                      'paste the SigmaPlot graph into the slide view
Set PPApp = Nothing                              'release system resources

Running this macro will paste the graph imported from an Excel worksheet into a PowerPoint slide.

SigmaPlot Download gr7

An obvious question is, "how easy is it to modify this macro to work with Microsoft Word"? 

Pasting a Graph into Word

This is a simple modification of the PowerPoint macro. We'll keep the startup and shutdown portions of the PowerPoint code (modifying it to refer to Word) and use the Word macro recorder to get an idea about what Word automation code to use.

With slight modifications the initial macro code is identical to that in PowerPoint.

'start Word
Dim WApp As Object
Set WApp=CreateObject("Word.Application")         'create Word application object in SigmaPlot
WApp.Visible=True                                   'start Word (if its not already running)

Recording the opening of a new blank Word document and pasting of a SigmaPlot graph gives

Documents.Add DocumentType:=wdNewBlankDocument
Selection.Paste

This was recorded in Word. Since we are creating a macro to run from SigmaPlot we need to specify the application and window so these statements become

'set up blank Word document
WApp.Documents.Add DocumentType:=wdNewBlankDocument
'paste SigmaPlot graph to Word document
WApp.ActiveWindow.Selection.Paste

With slight modification, the statement releasing system resources remains the same.

We need to reference the Microsoft Word Object Library. Click the Macro References icon in the SigmaPlot macro edit window and select this library. Save the macro to save this reference.

And that's it. You can run a copy of this macro by double clicking on the Graph to Word macro in the Graph to PowerPoint Macro notebook.

SigmaPlot Download gr8

Back to SigmaPlot Product Uses Page.

 

SigmaPlot gr 1

 

 

 

Buy Sigma Plot!

Sigma Plot
Product Details

21 CFR 11
Sigma Plot Capabilities
Sigma Plot Requirements
Use Within SPSS
New in Sigma Plot 8.0
New in SigmaPlot 9.0
New in SigmaPlot 10.0

Sigma Plot
Resources

Sigma Plot Add-on Modules
Sigma Plot FAQ
Graph Showcase
Sigma Plot Quotes
Sigma Plot Product Uses
Technical Support

SPSS Base
Add-on Modules

SPSS Advanced Models
SPSS Categories
SPSS Complex Samples
SPSS Conjoint
SPSS Exact Tests
SPSS Maps
SPSS Missing Value
   Analysis
SPSS Regression
   Models
SPSS Tables
SPSS Trends

SPSS Other Products
SPSS Amos
SPSS AnswerTree
SPSS Data Entry Builder
SPSS Data Entry Station
SPSS Data Entry System
SPSS DecisionTime
SPSS SamplePower
SPSS SmartViewer
SPSS TextSmart

SPSS Training
SPSS Web-based Training

Other Products
AutoSignal
PeakFit
SigmaPlot
SigmaScan
SigmaStat
SYSTAT
TableCurve 2D
TableCurve 3D

 

 

 

bottombar221

Gold Jewelry