Results 1 to 2 of 2
  1. #1
    JonMulder is offline Novice
    Windows XP Access 2007
    Join Date
    Apr 2011
    Posts
    24

    Want to Move Excel Chart to Last Tab Using Access VBA

    Greetings,

    I've been struggling with this for a few hours and need to reach out.

    I am creating Excel charts in Access. I have creating an Excel application object (if that's the right terminology) named as "x1". Most of the posts I've seen say to use the "Move after:=x1.Sheets.Count" method to position the Activechart to the last tab. I can't seem to get this to work (all other Excel code DOES work fine).

    Here's a snippet of my code:

    Code:
    x1.Charts.Add
    'Delete all Series.
    With x1.ActiveChart
       For i = .SeriesCollection.Count To 1 Step -1
          .SeriesCollection(i).Delete
       Next i
    End With
    x1.ActiveChart.Location Where:=xlLocationAsNewSheet
    x1.ActiveChart.Move after:=x1.Sheets.Count
    '''x1.ActiveChart.Move after:=Sheets(Sheets.Count) 'This line rem'd out.
    x1.ActiveChart.ChartType = xlLineMarkers
    x1.ActiveChart.HasTitle = True
    Thanks for any insight, folks can provide!

    Jon Mulder
    Engineering Geologist
    California Department of Water Resources

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,825
    I use the chart control wizard. I have used VBA code to customize the chart control properties. I have never used code to create chart. However, might be good idea to learn this method because apparently the chart control has been removed from Access 2013.

    You might be better off posting in an Excel/VBA forum.

    This thread has an example for creating chart and does something different for locating the chart http://www.ozgrid.com/forum/showthread.php?t=28555

    ActiveChart.Location Where:=xlLocationAsObject, Name:=strSheetName
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Problem Creating Excel Chart TextBoxes in Access 2010
    By JonMulder in forum Programming
    Replies: 5
    Last Post: 03-24-2013, 08:16 PM
  2. Replies: 9
    Last Post: 01-29-2013, 06:44 PM
  3. Move data from excel to Access
    By Newby in forum Access
    Replies: 6
    Last Post: 01-29-2013, 12:25 PM
  4. Pivot chart or Excel?
    By Daryl2106 in forum Access
    Replies: 1
    Last Post: 05-14-2012, 01:37 PM
  5. Replies: 2
    Last Post: 07-12-2010, 05:39 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums