Solved

Creating Excel using vba in Access

Posted on 2011-03-14
6
578 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
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 
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

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
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…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

786 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