<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: How To: Record Your Own Macro</title>
	<atom:link href="http://peltiertech.com/WordPress/how-to-recording-your-own-macro/feed/" rel="self" type="application/rss+xml" />
	<link>http://peltiertech.com/WordPress/how-to-recording-your-own-macro/</link>
	<description>Peltier Tech Excel Charts and Programming Blog</description>
	<lastBuildDate>Tue, 22 May 2012 11:00:35 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
	<item>
		<title>By: Jon Peltier</title>
		<link>http://peltiertech.com/WordPress/how-to-recording-your-own-macro/comment-page-1/#comment-134224</link>
		<dc:creator>Jon Peltier</dc:creator>
		<pubDate>Wed, 21 Sep 2011 11:33:19 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/2008/03/10/how-to-recording-your-own-macro/#comment-134224</guid>
		<description>Asad -

If there&#039;s an unprotected active sheet, that line of code ought to work.</description>
		<content:encoded><![CDATA[<p>Asad -</p>
<p>If there&#8217;s an unprotected active sheet, that line of code ought to work.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Asad</title>
		<link>http://peltiertech.com/WordPress/how-to-recording-your-own-macro/comment-page-1/#comment-134121</link>
		<dc:creator>Asad</dc:creator>
		<pubDate>Wed, 21 Sep 2011 05:14:46 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/2008/03/10/how-to-recording-your-own-macro/#comment-134121</guid>
		<description>Hi Jon, 
I had a recorded macro for chart creation in 2003 and it does not work in 2007.
I had used your dynamic charting by dates procedure to make the chart.
Can you help ? It stops at the Set ChtObj line.


Sub MainGraph(wanum As String)
&#039;
&#039; Macro1 Macro
&#039; 
    Dim wsItem As Worksheet
    Dim chtObj As ChartObject
    Dim chrObj As Integer
    For Each wsItem In ThisWorkbook.Worksheets

        For Each chtObj In wsItem.ChartObjects

            chtObj.Delete

        Next

    Next




    Set chtObj = ActiveSheet.ChartObjects.Add(Left:=250, Width:=700, Top:=170, Height:=400)


    With chtObj.Chart
        &#039; remove extra series
        Do Until .SeriesCollection.Count = 0
            .SeriesCollection(1).Delete
        Loop
    End With
    &#039;
    chrObj = 1
    &#039;Charts.Add

    With chtObj.Chart
        .ChartType = xlLine
        .SeriesCollection.NewSeries.XValues = &quot;=APChart.xls!ChartDates&quot;

        .SeriesCollection(1).Name = &quot;Estimate&quot;
        .SeriesCollection(1).Values = &quot;=APChart.xls!ChartFirmA&quot;

        .SeriesCollection.NewSeries.XValues = &quot;=APChart.xls!ChartDates&quot;

        .SeriesCollection(2).Name = &quot;Actuals&quot;
        .SeriesCollection(2).Values = &quot;=APChart.xls!ChartFirmB&quot;

        .Location Where:=xlLocationAsObject, Name:=&quot;NewAP&quot;
        .Parent.Name = &quot;CHART&quot; &amp; chrObj
    End With

    With ActiveChart
        .HasTitle = True
        .ChartTitle.Characters.Text = &quot;Estimate/Actuals &quot; &amp; wanumb &amp; Space(5) &amp; &quot;(As of  &quot; &amp; Date &amp; &quot;)&quot;
        .Axes(xlCategory, xlPrimary).HasTitle = True
        .Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = &quot;Years/Months&quot;
        .Axes(xlValue, xlPrimary).HasTitle = True
        .Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = &quot;Hours&quot;
    End With
    ActiveChart.SeriesCollection(1).Select
    With Selection.Border
        .Weight = xlThin
        .LineStyle = xlAutomatic
    End With
    With Selection
        .MarkerBackgroundColorIndex = 5
        .MarkerForegroundColorIndex = 5
        .MarkerStyle = xlDiamond
        .Smooth = False
        .MarkerSize = 6
        .Shadow = False
    End With

    ActiveChart.SeriesCollection(2).Select
    ActiveChart.SeriesCollection(2).ChartType = xlColumnClustered
    With Selection.Interior
        .ColorIndex = 1
        .Pattern = xlSolid
    End With

    ActiveChart.ChartArea.Select
    With Selection.Border
        .Weight = 1
        .LineStyle = -1
    End With
    Selection.Interior.ColorIndex = xlAutomatic
    Sheets(&quot;New787&quot;).DrawingObjects(&quot;CHART&quot; &amp; chrObj).RoundedCorners = False
    Sheets(&quot;New787&quot;).DrawingObjects(&quot;CHART&quot; &amp; chrObj).Shadow = False
    ActiveChart.SeriesCollection(2).Select
    With Selection.Border
        .Weight = xlThin
        .LineStyle = xlAutomatic
    End With
    Selection.Shadow = False
    Selection.InvertIfNegative = False
    With Selection.Interior
        .ColorIndex = 1
        .Pattern = xlSolid
    End With

    

    ActiveSheet.ChartObjects(&quot;CHART&quot; &amp; chrObj).Activate
    ActiveChart.ChartArea.Select
    ActiveChart.Axes(xlValue).Select
    Selection.TickLabels.NumberFormat = &quot;0&quot;
    ActiveChart.ChartArea.Select
    ActiveWindow.Visible = False
    &#039;Windows(&quot;APChart.xls&quot;).Activate
    &#039;Range(&quot;U40&quot;).Select
    ActiveSheet.Shapes(&quot;CHART&quot; &amp; chrObj).Select
    Selection.Locked = False
    ActiveSheet.Protect
    ActiveWindow.ScrollRow = 7
    With ActiveChart
        .Legend.Top = 5
        .Legend.Left = 5
    End With

    &#039;Call ExportChart
    &#039; ActiveSheet.Shapes(&quot;CHART&quot; &amp; chrObj).Select
    Windows(&quot;APChart.xls&quot;).Activate
    Range(&quot;A3&quot;).Select
End Sub</description>
		<content:encoded><![CDATA[<p>Hi Jon,<br />
I had a recorded macro for chart creation in 2003 and it does not work in 2007.<br />
I had used your dynamic charting by dates procedure to make the chart.<br />
Can you help ? It stops at the Set ChtObj line.</p>
<p>Sub MainGraph(wanum As String)<br />
&#8216;<br />
&#8216; Macro1 Macro<br />
&#8216;<br />
    Dim wsItem As Worksheet<br />
    Dim chtObj As ChartObject<br />
    Dim chrObj As Integer<br />
    For Each wsItem In ThisWorkbook.Worksheets</p>
<p>        For Each chtObj In wsItem.ChartObjects</p>
<p>            chtObj.Delete</p>
<p>        Next</p>
<p>    Next</p>
<p>    Set chtObj = ActiveSheet.ChartObjects.Add(Left:=250, Width:=700, Top:=170, Height:=400)</p>
<p>    With chtObj.Chart<br />
        &#8216; remove extra series<br />
        Do Until .SeriesCollection.Count = 0<br />
            .SeriesCollection(1).Delete<br />
        Loop<br />
    End With<br />
    &#8216;<br />
    chrObj = 1<br />
    &#8216;Charts.Add</p>
<p>    With chtObj.Chart<br />
        .ChartType = xlLine<br />
        .SeriesCollection.NewSeries.XValues = &#8220;=APChart.xls!ChartDates&#8221;</p>
<p>        .SeriesCollection(1).Name = &#8220;Estimate&#8221;<br />
        .SeriesCollection(1).Values = &#8220;=APChart.xls!ChartFirmA&#8221;</p>
<p>        .SeriesCollection.NewSeries.XValues = &#8220;=APChart.xls!ChartDates&#8221;</p>
<p>        .SeriesCollection(2).Name = &#8220;Actuals&#8221;<br />
        .SeriesCollection(2).Values = &#8220;=APChart.xls!ChartFirmB&#8221;</p>
<p>        .Location Where:=xlLocationAsObject, Name:=&#8221;NewAP&#8221;<br />
        .Parent.Name = &#8220;CHART&#8221; &amp; chrObj<br />
    End With</p>
<p>    With ActiveChart<br />
        .HasTitle = True<br />
        .ChartTitle.Characters.Text = &#8220;Estimate/Actuals &#8221; &amp; wanumb &amp; Space(5) &amp; &#8220;(As of  &#8221; &amp; Date &amp; &#8220;)&#8221;<br />
        .Axes(xlCategory, xlPrimary).HasTitle = True<br />
        .Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = &#8220;Years/Months&#8221;<br />
        .Axes(xlValue, xlPrimary).HasTitle = True<br />
        .Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = &#8220;Hours&#8221;<br />
    End With<br />
    ActiveChart.SeriesCollection(1).Select<br />
    With Selection.Border<br />
        .Weight = xlThin<br />
        .LineStyle = xlAutomatic<br />
    End With<br />
    With Selection<br />
        .MarkerBackgroundColorIndex = 5<br />
        .MarkerForegroundColorIndex = 5<br />
        .MarkerStyle = xlDiamond<br />
        .Smooth = False<br />
        .MarkerSize = 6<br />
        .Shadow = False<br />
    End With</p>
<p>    ActiveChart.SeriesCollection(2).Select<br />
    ActiveChart.SeriesCollection(2).ChartType = xlColumnClustered<br />
    With Selection.Interior<br />
        .ColorIndex = 1<br />
        .Pattern = xlSolid<br />
    End With</p>
<p>    ActiveChart.ChartArea.Select<br />
    With Selection.Border<br />
        .Weight = 1<br />
        .LineStyle = -1<br />
    End With<br />
    Selection.Interior.ColorIndex = xlAutomatic<br />
    Sheets(&#8220;New787&#8243;).DrawingObjects(&#8220;CHART&#8221; &amp; chrObj).RoundedCorners = False<br />
    Sheets(&#8220;New787&#8243;).DrawingObjects(&#8220;CHART&#8221; &amp; chrObj).Shadow = False<br />
    ActiveChart.SeriesCollection(2).Select<br />
    With Selection.Border<br />
        .Weight = xlThin<br />
        .LineStyle = xlAutomatic<br />
    End With<br />
    Selection.Shadow = False<br />
    Selection.InvertIfNegative = False<br />
    With Selection.Interior<br />
        .ColorIndex = 1<br />
        .Pattern = xlSolid<br />
    End With</p>
<p>    ActiveSheet.ChartObjects(&#8220;CHART&#8221; &amp; chrObj).Activate<br />
    ActiveChart.ChartArea.Select<br />
    ActiveChart.Axes(xlValue).Select<br />
    Selection.TickLabels.NumberFormat = &#8220;0&#8243;<br />
    ActiveChart.ChartArea.Select<br />
    ActiveWindow.Visible = False<br />
    &#8216;Windows(&#8220;APChart.xls&#8221;).Activate<br />
    &#8216;Range(&#8220;U40&#8243;).Select<br />
    ActiveSheet.Shapes(&#8220;CHART&#8221; &amp; chrObj).Select<br />
    Selection.Locked = False<br />
    ActiveSheet.Protect<br />
    ActiveWindow.ScrollRow = 7<br />
    With ActiveChart<br />
        .Legend.Top = 5<br />
        .Legend.Left = 5<br />
    End With</p>
<p>    &#8216;Call ExportChart<br />
    &#8216; ActiveSheet.Shapes(&#8220;CHART&#8221; &amp; chrObj).Select<br />
    Windows(&#8220;APChart.xls&#8221;).Activate<br />
    Range(&#8220;A3&#8243;).Select<br />
End Sub</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Fred</title>
		<link>http://peltiertech.com/WordPress/how-to-recording-your-own-macro/comment-page-1/#comment-133636</link>
		<dc:creator>Fred</dc:creator>
		<pubDate>Mon, 19 Sep 2011 22:52:10 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/2008/03/10/how-to-recording-your-own-macro/#comment-133636</guid>
		<description>You were right. I hadn&#039;t noticed yet that IT service had installed Office 2007 instead of 2010 on my new laptop. Sorry for this mistake. I prefer explicit statements too. The macro recorder can be usefull to obtain the exact VBA shape name...
Thanks again</description>
		<content:encoded><![CDATA[<p>You were right. I hadn&#8217;t noticed yet that IT service had installed Office 2007 instead of 2010 on my new laptop. Sorry for this mistake. I prefer explicit statements too. The macro recorder can be usefull to obtain the exact VBA shape name&#8230;<br />
Thanks again</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jon Peltier</title>
		<link>http://peltiertech.com/WordPress/how-to-recording-your-own-macro/comment-page-1/#comment-133609</link>
		<dc:creator>Jon Peltier</dc:creator>
		<pubDate>Mon, 19 Sep 2011 21:09:48 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/2008/03/10/how-to-recording-your-own-macro/#comment-133609</guid>
		<description>Fred -

I inserted, moved, and resized a rectangle in Excel 2010 with the macro recorder on, and got this code:

&lt;pre class=&quot;vbasmall&quot;&gt;&lt;code&gt;Sub Macro2()
    ActiveSheet.Shapes.AddShape(msoShapeRectangle, 153.75, 63, 176.25, 63).Select
    Selection.ShapeRange.IncrementLeft 202.5
    Selection.ShapeRange.IncrementTop 89.25
    Selection.ShapeRange.ScaleWidth 0.4127659574, msoFalse, msoScaleFromBottomRight
End Sub&lt;/code&gt;&lt;/pre&gt;

In general I prefer using explicit size and position statements:

&lt;pre class=&quot;vbasmall&quot;&gt;&lt;code&gt;With ActiveSheet.Shapes(1)
    .Left = 100
    .Top = 75
    .Width = 125
    .Height = 75
End With&lt;/code&gt;&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Fred -</p>
<p>I inserted, moved, and resized a rectangle in Excel 2010 with the macro recorder on, and got this code:</p>
<pre class="vbasmall"><code>Sub Macro2()
    ActiveSheet.Shapes.AddShape(msoShapeRectangle, 153.75, 63, 176.25, 63).Select
    Selection.ShapeRange.IncrementLeft 202.5
    Selection.ShapeRange.IncrementTop 89.25
    Selection.ShapeRange.ScaleWidth 0.4127659574, msoFalse, msoScaleFromBottomRight
End Sub</code></pre>
<p>In general I prefer using explicit size and position statements:</p>
<pre class="vbasmall"><code>With ActiveSheet.Shapes(1)
    .Left = 100
    .Top = 75
    .Width = 125
    .Height = 75
End With</code></pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Fred</title>
		<link>http://peltiertech.com/WordPress/how-to-recording-your-own-macro/comment-page-1/#comment-133606</link>
		<dc:creator>Fred</dc:creator>
		<pubDate>Mon, 19 Sep 2011 21:03:05 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/2008/03/10/how-to-recording-your-own-macro/#comment-133606</guid>
		<description>Thanks for the quick answer. 

In fact I&#039;am currently using Excel 2010 and I have nothing recorded in my macro when, for exemple, I change dimensions of a rectangle . May be there&#039;s an option to select when we work with shapes? Any ideas?</description>
		<content:encoded><![CDATA[<p>Thanks for the quick answer. </p>
<p>In fact I&#8217;am currently using Excel 2010 and I have nothing recorded in my macro when, for exemple, I change dimensions of a rectangle . May be there&#8217;s an option to select when we work with shapes? Any ideas?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jon Peltier</title>
		<link>http://peltiertech.com/WordPress/how-to-recording-your-own-macro/comment-page-1/#comment-133595</link>
		<dc:creator>Jon Peltier</dc:creator>
		<pubDate>Mon, 19 Sep 2011 20:40:44 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/2008/03/10/how-to-recording-your-own-macro/#comment-133595</guid>
		<description>Fred -

Microsoft had to rush at the end of the Office 2007 development cycle to prepare it for release, that they did not have resources to update the macro recorder for the brand new Office shapes. This affects charts too, since the pieces that comprise the charts are also new Office shapes.

Excel 2010 has a lot of the macro recorder goodies that Excel 2007 lacks.</description>
		<content:encoded><![CDATA[<p>Fred -</p>
<p>Microsoft had to rush at the end of the Office 2007 development cycle to prepare it for release, that they did not have resources to update the macro recorder for the brand new Office shapes. This affects charts too, since the pieces that comprise the charts are also new Office shapes.</p>
<p>Excel 2010 has a lot of the macro recorder goodies that Excel 2007 lacks.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

