Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Creating Excel using vba in Access

Posted on 2011-03-14
6
583 Views
Last Modified: 2012-05-11
Hi Experts,

I have a Clustred bar chart in a Excel file that i create using vba code in Access. Every thing is working fine, but some settings is very hard to control.

I want to do this to the bar chart:
ActiveChart.SetElement (msoElementPrimaryCategoryAxisWithoutLabels)

AND

ActiveChart.SetElement (msoElementDataLabelOutSideEnd)

But as you all know, this will give a error in access :-(

So now to the big question, how do make these settings from Access using vba code?
0
Comment
Question by:DCRAPACCESS
  • 3
  • 3
6 Comments
 

Accepted Solution

by:
DCRAPACCESS earned 0 total points
ID: 35126583
Found the solution by an accident :-)

This part is good enough:
ActiveChart.SetElement()

It is this part that Access cannot understand:
msoElementPrimaryCategoryAxisWithoutLabels

I have found this webpage, that translate "msoElementPrimaryCategoryAxisWithoutLabels" into a number:
https://msofficefornet.svn.codeplex.com/svn/01%20-%20Common/MsoChartElementType.vb

Writing "ActiveChart.SetElement(350)" works like a charm :-)
0
 

Author Closing Comment

by:DCRAPACCESS
ID: 35126585
>Found the solution my self
0
 
LVL 30

Expert Comment

by:SiddharthRout
ID: 35126587
>>> Found the solution by an accident :-)

I had finished typing and pressed refreshed to see if someone had answered and then saw your post :)

Do this

Declare this at the beginning of the code as the msoElementPrimaryCategoryAxisWithoutLabels and msoElementDataLabelOutSideEnd  are Excel Constatnts :)

Const msoElementPrimaryCategoryAxisWithoutLabels As Long = 350. 2445
Const msoElementDataLabelOutSideEnd As Long = 205

Sid
0
Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

 
LVL 30

Expert Comment

by:SiddharthRout
ID: 35126608
This will teach me to type faster . LOL

Sid
0
 

Author Comment

by:DCRAPACCESS
ID: 35126682
What about formatting the color of the LegendKeys?
0
 
LVL 30

Expert Comment

by:SiddharthRout
ID: 35126771
Sorry. had stepped out for a moment.

Do you mean this? I am just typing from memory.

Dim objSeries As Object

With ActiveChart
    For Each objSeries In .SeriesCollection
        '~~> Set necessary formatting here.
        objSeries.Border.colorIndex= 3 '<~~ color Red
    Next
End With

Open in new window


Sid
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question