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

    Problem Creating Excel Chart TextBoxes in Access 2010

    Greetings,

    I made up an Excel VBA module to automatically create fairly complex charts with several textboxes. I've since learned that I can invoke Excel inside Access and create the charts. This is going VERY well, and the charts look great. However, when I want to start adding some textboxes, I get an error message "Variable not defined". For some reason, it doesn't like "msoTextOrientationHorizontal". I have the Microsoft Excel 14.0 Object Library referenced.

    Below is a distillation of my code:
    Code:
     
    Dim x1 As Excel.Application
    Set x1 = New Excel.Application
    'Lots of code here creating the chart object.
     x1.ActiveChart.Shapes.AddTextbox(msoTextOrientationHorizontal, 100, 100, 200, 50).Select
    x1.Selection.Characters.Text = "State Well" & vbNewLine & "Number"
    Any ideas? Thanks in advance for what light folks can shed on this!

    Jonathan Mulder
    Engineering Geologist


    California Department of Water Resources

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,900
    Do you have reference set to the Microsoft Office 14.0 Object Library as well?
    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.

  3. #3
    JonMulder is offline Novice
    Windows XP Access 2007
    Join Date
    Apr 2011
    Posts
    24
    Yep, I think that was my problem. I added the Microsoft Office 14.0 Object Library and it works now! Now I can print some pretty complex water well hydrographs directly from my Access application.

    Thanks for the help!

    Jon Mulder
    Engineering Geologist
    California Department of Water Resources

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,900
    I assume you are aware Access 2007 has graphing capability, although not as versatile as what Excel can accomplish and perhaps your graphing requirements are too complicated for Access.
    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.

  5. #5
    JonMulder is offline Novice
    Windows XP Access 2007
    Join Date
    Apr 2011
    Posts
    24
    Yes, doing the graphs directly in Access was my first thought. But the hydrographs are fairly complex. The vertical axis varies depending upon the depth to groundwater (can vary from several feet to several hundred feet). The horizontal axis varies depending upon the "period of record" of groundwater measurements (several years to almost a century). Also, I need to plot several wells together on one chart if it's a multiple completion well. Actually I put most of the coding together in Excel over a year ago for a project to chart our water well dataloggers (which records water level every hour and some wells have a history going back 25 years -- lots of data!). So, getting it to work in my Access application took half a weekend, which is good. OTOH, I need to get a life and get out in the garden on weekends! <g>

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,900
    I also have graphs with variable ranges for the axes. I use VBA to set the min a max range limits and major and minor increments. If you already have Excel interface working satisfactorily then I can understand reluctance to go through development exercise again.
    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. How to Create Chart in Access 2010
    By braveali in forum Access
    Replies: 8
    Last Post: 04-21-2014, 11:07 AM
  2. Can not import any excel 2010 spreadsheet into access 2010
    By BobsWright in forum Import/Export Data
    Replies: 4
    Last Post: 09-26-2013, 12:44 PM
  3. Access 2010 VBA Creating Pivot Table in Excel
    By Tomlon in forum Programming
    Replies: 1
    Last Post: 02-07-2013, 02:25 PM
  4. Replies: 4
    Last Post: 09-19-2012, 02:07 AM
  5. Problem with sum of three textboxes.
    By SFC in forum Reports
    Replies: 3
    Last Post: 02-01-2012, 10:10 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