|
VB 6 Helper Newsletter
|
Rod Stephens
|
Nov 11, 2008 07:53 PST
|
First, several non-example items:
-----
Big News: My latest book is out.
Beginning Database Design Solutions
http://www.amazon.com/exec/obidos/ASIN/0470385499/vbhelper/
This book explains how to design databases. How to gather requirements,
convert the requirements into relational database designs, turn those
into tables, and normalize and otherwise refine the design to improve
performance and flexibility.
The book doesn't use any programming language such as VB or C#. (It does
cover a bit of SQL but you don't need to know any before you read the
book.)
As the title says, it's aimed at beginners, but like my other books it's
not for idiots. Just because you haven't built relational databases
before, that doesn't mean you can't learn a lot of material in one book.
I think the book does a good job of introducing database design and
getting you to the point where you can build an efficient and robust
database.
Follow the Amazon link
(http://www.amazon.com/exec/obidos/ASIN/0470385499/vbhelper/) and take a
look. (I still need to build the book's home page on the VB Helper Web
site.)
If you read it, post a review! Books live and die on their reviews.
-----
Sorry about the dearth of newsletters lately, particularly if you're
subscribed to the VB 6 only newsletter. I don't do as much VB 6
programming as I used to (my customers need some maintenance work but no
new development). I also have a couple thousand examples in VB 6 so I
don't think of new examples very often.
If you want to see more VB 6 material, email me and ask questions. I may
not have time for everything but I might and you may give me some ideas.
-----
For .NET developers: If you haven't looked at WPF yet, you should soon.
In a nutshell, WPF (Windows Presentation Foundation) is a library of new
controls and objects that Microsoft has anointed as the next great thing
in user interface design. It's inconsistent, awkward, the support in the
IDE is mediocre at best, and seems poorly planned. It also seems like
they could have included the new features in the existing Windows Forms
controls.
However, for better or worse, Microsoft is going to push it on us. And
if you're building relatively simple interfaces, aside from some big
omissions such as reporting tools and a data grid, it's not too bad. It
also has some nice new features and can produce some amazing results.
I should have a series of DevX articles coming out over the upcoming
months and I should be posting a bunch of WPF examples in the near
future.
-----
Have a great week and thanks for subscribing!
Rod
RodSte-@vb-helper.com
----------
*** Now Available ***
Visual Basic 2008 Programmer's Reference
http://www.amazon.com/exec/obidos/ASIN/0470182628/vbhelper/
==========
Both Contents:
1. New HowTo: Use VBA code to make a pie chart in Excel
==========
++++++++++
<Both>
++++++++++
==========
1. New HowTo: Use VBA code to make a pie chart in Excel
http://www.vb-helper.com/howto_excel_make_pie_chart.html
http://www.vb-helper.com/HowTo/howto_excel_make_pie_chart.zip
(Image at http://www.vb-helper.com/howto_excel_make_pie_chart.jpg)
Subroutine MakePieChart builds a pie chart. This example builds a pie
chart showing sales per month. It takes as parameters:
- A title to put on the chart.
- A title for the categories to graph (in this example, Month).
- An array of category values (January, February, and so forth).
- The title for the values (in this example, Sales).
- An array of values (the sales per month).
The subroutine first created a new worksheet and names it after the
title parameter. It makes column headers in cells A1 and B1, and then
copies the categories and values into columns A and B.
The code then builds the chart. It sets the chart's type, data source,
and details such as the title.
Public Sub MakePieChart(ByVal title As String, ByVal category_title As
String, category_values() As String, ByVal value_title As String,
values() As Single)
Dim work_book As Workbook
Dim last_sheet As Worksheet
Dim new_sheet As Worksheet
Dim r As Integer
Dim min_r As Integer
Dim new_chart As Chart
' Make a new worksheet.
Set work_book = Application.ActiveWorkbook
Set last_sheet = work_book.Sheets(work_book.Sheets.Count)
Set new_sheet = work_book.Sheets.Add(after:=last_sheet)
new_sheet.Name = title
' Make the column headers.
new_sheet.Cells(1, 1) = category_title
new_sheet.Cells(1, 2) = value_title
With new_sheet.Range("A1:B1")
.HorizontalAlignment = xlCenter ' Centered.
With .Font
.FontStyle = "Bold" ' Bold.
.Size = .Size + 2 ' Bigger.
.ColorIndex = 3 ' Red.
End With
End With
' Write the data.
min_r = 2 - LBound(category_values)
For r = LBound(category_values) To UBound(category_values)
new_sheet.Cells(r + min_r, 1) = category_values(r)
Next r
min_r = 2 - LBound(values)
For r = LBound(values) To UBound(values)
new_sheet.Cells(r + min_r, 2) = values(r)
Next r
' Make the chart.
Set new_chart = Charts.Add()
ActiveChart.ChartType = xlPie
ActiveChart.SetSourceData _
Source:=new_sheet.Range("A1:B" & UBound(values) + min_r), _
PlotBy:=xlColumns
ActiveChart.Location Where:=xlLocationAsObject, Name:=title
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = title
End With
' Move the chart.
new_sheet.Shapes(1).IncrementLeft -80
new_sheet.Shapes(1).IncrementTop -140
End Sub
==========
Archives:
http://www.topica.com/lists/VBHelper
http://www.topica.com/lists/VB6Helper
http://www.topica.com/lists/VBNetHelper
http://www.vb-helper.com/cgi-bin/mojo/mojo.cgi?flavor=archive&list=VB_Helper_Newsletter
Post questions at:
http://www.topica.com/lists/VBHelperQA
|
|
 |
|