Consulting

Page 1 of 2 1 2 LastLast
Results 1 to 20 of 29

Thread: Solved: bar diagram

  1. #1

    Solved: bar diagram

    How Can I have an actice bar diagram on a User Form in VBA in Excel and how to define the macros for that?

  2. #2
    MS Excel MVP VBAX Tutor
    Joined
    Mar 2005
    Posts
    246
    Location
    Two ways:

    Export chart as image file, load picture into image control on form
    http://www.j-walk.com/ss/excel/tips/tip66.htm

    Copy chart, use APIs to load clipboard contents into image control
    http://oaltd.co.uk/DLCount/DLCount.a...stePicture.zip

    You could also investigate the Office Web Charting Component, but I have never used it.
    - Jon
    -------
    Jon Peltier, Microsoft Excel MVP
    Peltier Technical Services
    Tutorials and Custom Solutions
    http://PeltierTech.com
    _______

  3. #3
    I cannot download the demo file in the first link. in the second Zip file there is a lot of programming under module and form. Is there any easier way to make an active Bar diagram?

  4. #4
    MS Excel MVP VBAX Tutor
    Joined
    Mar 2005
    Posts
    246
    Location
    If there were a simpler way, do you think such smart programmers as John Walkenbach and Stephen Bullen would have wasted time developing these techniques?
    - Jon
    -------
    Jon Peltier, Microsoft Excel MVP
    Peltier Technical Services
    Tutorials and Custom Solutions
    http://PeltierTech.com
    _______

  5. #5
    Administrator
    Chat VP
    VBAX Guru johnske's Avatar
    Joined
    Jul 2004
    Location
    Townsville, Australia
    Posts
    2,872
    Location
    I'm not into charting, but I have a basic example of a userform chart using OWC (Office Web Components) here that I did up for demo purposes that may get you started...
    You know you're really in trouble when the light at the end of the tunnel turns out to be the headlight of a train hurtling towards you

    The major part of getting the right answer lies in asking the right question...


    Made your code more readable, use VBA tags (this automatically inserts [vba] at the start of your code, and [/vba ] at the end of your code) | Help those helping you by marking your thread solved when it is.

  6. #6
    Dear JohnSke,
    This is fine. but how can I put North,south,Esat,west the horizentol axis and 1997 and 1998 the vertical bar diagrams?



    Thanks & Regaeds,
    Maryam

  7. #7
    Administrator
    Chat VP VBAX Guru johnske's Avatar
    Joined
    Jul 2004
    Location
    Townsville, Australia
    Posts
    2,872
    Location
    Where it says .Type = chChartTypeBarClustered, change that to .Type = chChartTypeColumnClustered
    You know you're really in trouble when the light at the end of the tunnel turns out to be the headlight of a train hurtling towards you

    The major part of getting the right answer lies in asking the right question...


    Made your code more readable, use VBA tags (this automatically inserts [vba] at the start of your code, and [/vba ] at the end of your code) | Help those helping you by marking your thread solved when it is.

  8. #8
    Administrator
    Chat VP VBAX Guru johnske's Avatar
    Joined
    Jul 2004
    Location
    Townsville, Australia
    Posts
    2,872
    Location
    FYI, here's a list of all the chart-types available for OWC charts...


    chChartTypeArea
    chChartTypeAreaStacked
    chChartTypeAreaStacked100
    chChartTypeBarClustered
    chChartTypeBarStacked
    chChartTypeBarStacked100
    chChartTypeBubble
    chChartTypeBubbleLine
    chChartTypeColumnClustered
    chChartTypeColumnStacked
    chChartTypeColumnStacked100
    chChartTypeCombo
    chChartTypeDoughnut
    chChartTypeDoughnutExploded
    chChartTypeLine
    chChartTypeLineMarkers
    chChartTypeLineStacked
    chChartTypeLineStacked100
    chChartTypeLineStacked100Markers
    chChartTypeLineStackedMarkers
    chChartTypePie
    chChartTypePieExploded
    chChartTypePieStacked
    chChartTypePolarLine
    chChartTypePolarLineMarkers
    chChartTypePolarMarkers
    chChartTypePolarSmoothLine
    chChartTypePolarSmoothLineMarkers
    chChartTypeRadarLine
    chChartTypeRadarLineFilled
    chChartTypeRadarLineMarkers
    chChartTypeRadarSmoothLine
    chChartTypeRadarSmoothLineMarkers
    chChartTypeScatterLine
    chChartTypeScatterLineFilled
    chChartTypeScatterLineMarkers
    chChartTypeScatterMarkers
    chChartTypeScatterSmoothLine
    chChartTypeScatterSmoothLineMarkers
    chChartTypeSmoothLine
    chChartTypeSmoothLineMarkers
    chChartTypeSmoothLineStacked
    chChartTypeSmoothLineStacked100
    chChartTypeSmoothLineStacked100Markers
    chChartTypeSmoothLineStackedMarkers
    chChartTypeStockHLC
    chChartTypeStockOHLC
    You know you're really in trouble when the light at the end of the tunnel turns out to be the headlight of a train hurtling towards you

    The major part of getting the right answer lies in asking the right question...


    Made your code more readable, use VBA tags (this automatically inserts [vba] at the start of your code, and [/vba ] at the end of your code) | Help those helping you by marking your thread solved when it is.

  9. #9
    Thank you Johnski.

  10. #10
    Dear Johnske,
    Where is VBA icon?

  11. #11
    Administrator
    Chat VP VBAX Guru johnske's Avatar
    Joined
    Jul 2004
    Location
    Townsville, Australia
    Posts
    2,872
    Location
    Quote Originally Posted by maryam
    Dear Johnske,
    Where is VBA icon?
    Sorry, what do you mean?
    You know you're really in trouble when the light at the end of the tunnel turns out to be the headlight of a train hurtling towards you

    The major part of getting the right answer lies in asking the right question...


    Made your code more readable, use VBA tags (this automatically inserts [vba] at the start of your code, and [/vba ] at the end of your code) | Help those helping you by marking your thread solved when it is.

  12. #12
    Made your code more readable, use VBA tags

  13. #13
    Administrator
    Chat VP VBAX Guru johnske's Avatar
    Joined
    Jul 2004
    Location
    Townsville, Australia
    Posts
    2,872
    Location
    Oh OK It's on the top just to the right of centre in the pane where you post your reply...
    You know you're really in trouble when the light at the end of the tunnel turns out to be the headlight of a train hurtling towards you

    The major part of getting the right answer lies in asking the right question...


    Made your code more readable, use VBA tags (this automatically inserts [vba] at the start of your code, and [/vba ] at the end of your code) | Help those helping you by marking your thread solved when it is.

  14. #14
    MS Excel MVP VBAX Tutor
    Joined
    Mar 2005
    Posts
    246
    Location
    So is the Office Web Component any simpler than using John's or Stephen's examples?
    - Jon
    -------
    Jon Peltier, Microsoft Excel MVP
    Peltier Technical Services
    Tutorials and Custom Solutions
    http://PeltierTech.com
    _______

  15. #15
    Dear JohnPeltier,
    I could just open Stephen's file and couldnt open demo file of John's.Thank you for replying my thread, but there were a lot of coding behind the module and form in Stephen's file which I couldnt understand. Office web component is just adding two controls to the form and 10 lines of programming. Sorry my VBA is very bad, but the problem is that I badly need it as I should develope a software related to chemical engineering as soon as possible. So I need your helps.



    Best Regards,
    Mariam

  16. #16
    MS Excel MVP VBAX Tutor
    Joined
    Mar 2005
    Posts
    246
    Location
    The problem with OWC is if you send the file to another user, they may not have OWC installed. OWC is not installed by default, nor is it an option in all editions of Office.

    Stephen's code is complicated, but you don't need to manipulate it much.

    Why could you not download John's example? Do the IT nazis at work prohibit downloads of exe files? His example is really pretty simple.
    - Jon
    -------
    Jon Peltier, Microsoft Excel MVP
    Peltier Technical Services
    Tutorials and Custom Solutions
    http://PeltierTech.com
    _______

  17. #17
    Administrator
    Chat VP VBAX Guru johnske's Avatar
    Joined
    Jul 2004
    Location
    Townsville, Australia
    Posts
    2,872
    Location
    Jon has a point there Maryam, OWC was only introduced in office 2000, so anyone using office 97 may have difficulties if they haven't installed OWC (it can be installed separately on '97).

    Now I have office 2000 and my own examples that were created in office 2000 have been downloaded from here and from my own site over 80 times with not one post to say that it doesn't work.

    However, I've noted that with others OWC files posted here that were created in office 2002 or 2003 - I can't get the OWC component to show simply because it was created in a later version.

    In other words, the only real problem I see would be if someone were trying to view it in an earlier version than yours - but if you're using the earliest version (office 2000) the only problem then would be '97 users.
    You know you're really in trouble when the light at the end of the tunnel turns out to be the headlight of a train hurtling towards you

    The major part of getting the right answer lies in asking the right question...


    Made your code more readable, use VBA tags (this automatically inserts [vba] at the start of your code, and [/vba ] at the end of your code) | Help those helping you by marking your thread solved when it is.

  18. #18
    dear Johnske I am using exel 2003.
    Dear JonPeltier, I cannot open John's example still. When I want to open the demonstration it goes to extraction and finally doesn't come!

  19. #19
    MS Excel MVP VBAX Tutor
    Joined
    Mar 2005
    Posts
    246
    Location
    Save the exe file to disk, then double click on it. I have had no problem in the three or four times I've tested this during the life of this thread.

    I would say in terms of ease and reliability, John's is best, Stephen's nearly so, and OWC somewhat further down the list.
    - Jon
    -------
    Jon Peltier, Microsoft Excel MVP
    Peltier Technical Services
    Tutorials and Custom Solutions
    http://PeltierTech.com
    _______

  20. #20
    Thank you JohnPeltier,
    I have another post about DATAGRID Control, Malik and Tommy replied to that thread, but now some there are some days that there is no other thread. DO you know about this also. Can you look at that post also please.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •