1. :
1.1. VBA.
1.2. .
2. :
2.1. .
2.2. IBM PC/XT.
2.3. MS Word.
2.4. Visual Basic for Application.
3. :
3.1. ( ).
3.2. 1. (. . 1) , . . . image, (. 1, 2).
3.3. 2. (. 3) , . . . . image, (. 3, 4, 5).
1 =cos(x)
2 =sin(x)
3
4
5
3.4. 3. Microsoft Excel, 7, Microsoft Word, :
6 .
3.5. .
3.6. . .
3.7. .
4. :
4.1. .
4.2. .
4.3. .
4.4. .
4.5. .
4.6. .
5. :
5.1. ?
5.2. ?
5.3. VBA. .
5.4. $A1?
5.5. Word?
5.6. Word?
5.7. ?
5.8. ?
5.9. VBA Excel ?
|
|
Excel
. chartobjects. chartobject , Chart, .
Chart
, Chart:
SubChartWizard ([Source], [Gallery], [Format], [PlotBy], [CategoryLabels], [SeriesLabels], [HasLegend], [Title], [CategoryTitle], [ValueTitle], [Extra-Title])
. (ChartWizard), , , , . , Chart. :
1) Source Range, . , , .
2) Gallery : xlArea, xlBar, xlColumn, xlLine, xlPie, xlRadar, xlXY-Scatter, xlCombination, xl3DArea, xl3DBar, xl3DColumn, xl3DLine, xl3DPie, xl3DSurface, xlDoughnut, xlDefaultAutoFormat.
3) Format . . , .
4) PlotBy PlotBy.
5) CategoryLabels SeriesLabels , , Source. .
6) , .
Sub SetSourceData (source as range, [plotby]). . plotby.
SubApplyCustomType (ChartTypeAsXlChartType, [typename]). , . , . charttype. , : xlbuiltin, xluserdefined xlanygallery. .
Function Export (filename as string, [filtername], [interactive]) as boolean , . , , , . interactive true, . export true .
|
|
Sub GetChartElement (x as long, y as long, elementid as long, argl as long, arg2 as long). , - . , x y. getchartelement , elementid , . , , x y .
Function Location (where as xlchartlocation, [name]) as
Chart. . Where : xlLocationAsNewSheet, xlLocationAsObject xlLocationAutomatic.
Name . Name .
VBA-. . (. 1) , . . , , . . (. 2) Image, (. 1).
, .
1 ()
2 ()
UserForm_Initialize
1. .
2. <Esc> , <Enter> .
3. , Image, Image.
CommandButton1__C1ick
1. , . .
2. . (. 3).
3. , , .
4. . (. 4).
5. DataSeries, 2, , ( graph.jpg Image1).
3
4
CommandButton2_C1ick
.
.
Private Sub CommandButton1_Click()
'
Dim _ As Double
Dim _ As Double
Dim _ As Double
Dim As String
Dim nx As Integer
'nx
Dim n As Integer
Dim i As Integer
'n,i
'
If IsNumeric(TextBox2.Text) = False Then
MsgBox , vbInformation,
TextBox2.SetFocus
Exit Sub
End If
If IsNumeric(TextBox3.Text) = False Then
MsgBox , vbInformation,
TextBox3.SetFocus
Exit Sub
|
|
End If
If IsNumeric(TextBox4.Text) = False Then
MsgBox , vbInformation,
TextBox4.SetFocus
Exit Sub
End If
'
_ = CDbl(TextBox2.Text)
_ = CDbl(TextBox3.Text)
_ = CDbl(TextBox4.Text)
= Trim(TextBox1.Text)
'
If _ >= _ Then
MsgBox , vbInformation,
TextBox2.SetFocus
Exit Sub
End If
If _ + _ >= _ Then
MsgBox , vbInformation,
TextBox3.SetFocus
Exit Sub
End If
' $A1
i = 1
Do
' $A1
If Mid(, i, 1) = x Or Mid(, i, 1) = X Then
n = Len()
If (1 < i) And (i < n) Then
= Left(, i 1) & $A1 & Right(, n i)
End If
If i = 1 Then
= $A1 & Right(, n 1)
End If
If i = n Then
= Left(, n 1) & $A1
End If
End If
i = i + 1
Loop While i <= Len()
ActiveSheet.Cells.Select
Selection.Clear
'
ActiveSheet.Range(A1).Select
'
With ActiveSheet
Range(A1).Value = _ ' A1
'
Range(A1).DataSeries Rowcol:=xlColumns, Type:=xlLinear, Step:=_, Stop:=_, Trend:=False
End With
'
With ActiveSheet
nx = Range(A1).CurrentRegion.Rows.Count
'
Range(B1).FormulaLocal =
' B1
If IsError(Evaluate()) = True Then
MsgBox , vbExclamation,
Exit Sub
End If
' Range(Cells(1, 2), Cells(nx, 2))
' B1,
' B1 Range(Cells(1, 2)
Cells(nx, 2))
Range(B1).AutoFill Destination:=Range(Cells(1, 2), Cells(nx, 2)), Type:=xlFillDefault
End With
ActiveSheet.ChartObjects.Delete
'
ActiveSheet.Range(Cells(1, 2), Cells(nx, 2)).Select
' ,
ActiveSheet.ChartObjects.Add(20, 19.5, 192, 192).Select
' , ,
' Image1
Application.CutCopyMode = False
'
ActiveChart.ChartWizard Source:=Range(Cells(1, 1), Cells(nx, 2)), Gallery:=xlLine, Format:=2, PlotBy:=xlColumns, CategoryLabels:=1, SeriesLabels:=0, HasLegend:=False, Title:="",
CategoryTitle:="", ValueTitle:=" y" & TextBox1.Text
ActiveSheet.ChartObjects(1).Activate
ActiveChart.Axes(xlValue).AxisTitle.Select
With Selection
HorizontalAlignment = xlCenter
VerticalAlignment = xlCenter
Orientation = xlUpward
End With
' Imagel
ActiveChart.Export Filename:="Graph.jpg",
FilterName:="JPEG"
UserForm1.Image1.Picture = LoadPicture(graph.jpg)
ActiveSheet.Range(A1).Select
End Sub
Private Sub CommandButton2 Click()
'
UserForm1.Hide
End Sub
Private Sub UserForm Initialize()
' , Imagel
|
|
With Imagel
PictureAlignment = fmPictureAlignmentTopLeft
PictureSizeMode = fmPictureSizeModeStretch
End With
End Sub
Excel - Microsoft Word, , .
Word :
Dim AppWord As Word.Application
Dim i As Long
C Word
Set AppWord = CreateObject("Word.Application")
:
AppWord.Visible = True
:
AppWord.Documents.Add
Range("A5:G5").Copy
AppWord.Selection.Paste
,
For i = 6 To 10
If Cells(i, 18) = True Then ' ...
Range(Cells(i, 1), Cells(i, 16)).Copy
AppWord.Selection.Paste ',
End If ' else
Next
Application.CutCopyMode = False
Word
Set AppWord = Nothing
End Sub
[1]
[2] InputBox.
[3] MsgBox.
[4] , , . , . - . : , . . . : , . .
[1]
[2]