Vba Komutlari
Vba Komutlari
Vba Komutlari
Program Flow
STATEMENT
[Public | Private] Declare Sub name Lib
libname [Alias aliasname] [([arglist])]
DESCRIPTION
Changes to the specified folder location.
Changes to the specified drive.
Closes a file opened using the Open statement.
Copies a file from the source to the specified
destination.
Deletes files from a disk. Use wildcards * for multiple
characters and ? For single characters.
Locks all or a portion of an open file to prevent access
by other processes.
Opens the specified file to allow input/output
operations.
Creates a new directory or folder.
Writes display-formatted data sequentially to a file.
Writes data contained in a variable to a disk file.
Closes all files opened using the Open statement.
Removes the specified folder.
Sets the attribute information for the specified file.
Unlocks a file to allow access by other processes.
Assigns the output line width for a file opened using
the Open statement.
Writes data to a sequential text file.
DESCRIPTION
Activates an application window.
Deletes a section or key setting from an applications
entry in the Windows Registry.
Saves an application entry in the applications entry in
the Windows Registry.
Sends one or more keystrokes to the active window as
if they were typed on the keyboard.
DESCRIPTION
Declares a reference to an external DLL library
function.
VBA KOMUTLARI
1/17
[Public | Private | Friend] [Static] Function name Defines a procedure that returns a value.
[(arglist)] [As type]
[statements]
[name = expression]
End Function
If condition Then
[statements]
[ElseIf condition-n Then
[elseifstatements] . . .
[Else
[elsestatements]]
End If
With object
[statements]
End With
VBA KOMUTLARI
2/17
Variable Declaration
STATEMENT
DESCRIPTION
[Public | Private] Const constname [As type] = expression Declares a constant value.
Dim [WithEvents] varname[([subscripts])] [As [New] type]
Friend [WithEvents] varname[([subscripts])] [As [New]
type]
Option Compare {Binary | Text | Database}
Option Explicit
Option Private
VBA KOMUTLARI
3/17
Array Functions
FUNCTION
Array(arg1,arg2, arg3, . . .)
LBound(arrayname[, dimension])
UBound(arrayname[, dimension])
DESCRIPTION
Creates a variant array containing the specified
elements.
Returns the smallest subscript for the specified array.
Returns the largest subscript for the specified array.
RETURNS
Variant
Long
Long
RETURNS
Integer
Boolean
Byte
Currency
Date
Double
Variant (Decimal)
Chr(charactercode)
CInt(expression)
Integer
Format(expression[, format[,
firstdayofweek[,
firstweekofyear]]])
Variant
FormatCurrency(Expression[,
NumDigitsAfterDecimal
[, IncludeLeadingDigit
[,UseParensForNegativeNum
bers
[, GroupDigits]]]])
FormatDateTime(Date[,
NamedFormat])
FormatNumber (Expression
[, NumDigitsAfterDecimal
[, IncludeLeadingDigit
[,
UseParensForNegativeNumb
ers
[, GroupDigits]]]])
FormatPercent (Expression
[,NumDigitsAfterDecimal
[,IncludeLeadingDigit
[,UseParensForNegativeNum
bers
[,GroupDigits]]]])
Hex(number)
Currency
Date
Mixed
String
String
CLng(expression)
CSng(expression)
CStr(expression)
CVar(expression)
Oct(number)
VBA KOMUTLARI
Long
Single
String
Variant
Variant (String)
4/17
Str(number)
Variant (String)
Val(string)
Mixed
RETURNS
Date
DESCRIPTION
Returns the current system date.
Returns a date that is the specified interval of time from
the original date.
Long
Date
DatePart(interval, date[,
firstdayofweek[,
firstweekofyear]])
DateSerial(year, month, day)
DateValue(date)
RETURNS
String
String
Integer
Long
Date
Long
Integer
Integer
5/17
Financial Functions
FUNCTION
DDB(cost, salvage, life, period[,
factor])
FV(rate, nper, pmt[, pv[, type]])
IPmt(rate, per, nper, pv[, fv[,
type]])
IRR(values(), [, guess])
MIRR(values(), finance_rate,
reinvest_rate)
NPer(rate, pmt, pv[, fv[, type]])
NPV(rate, values())
Pmt(rate, nper, pv[, fv[, type]])
PPmt(rate, per, nper, pv[, fv[,
type]])
PV(rate, nper, pmt[, fv[, type]])
Rate(nper, pmt, pv[, fv[, type[,
guess]]])
SLN(cost, salvage, life)
SYD(cost, salvage, life, period)
Information Functions
FUNCTION
CVErr(errornumber)
Error[(errornumber)]
IsArray(varname)
IsDate(expression)
IsEmpty(expression)
IsError(expression)
String
Long
Long
Long
DESCRIPTION
Specifies the depreciation value for an asset during a
specific time frame.
Determines the future value of an annuity based on
periodic fixed payments.
Determines the interest payment on an annuity for a
specific period of time.
Determines the internal rate of returns for a series of cash
flows.a series of cash flows.
Returns the modified interest rate of returns for a series of
periodic cash flows.
Returns the number of periods for an annuity.
Returns the net present value of an investment.
Returns the payment amount for an annuity based on
fixed payments.
RETURNS
Double
Double
Double
Double
Double
Double
Double
Double
Double
Double
RETURNS
Variant
String
Boolean
Boolean
Boolean
Boolean
IsMissing(argname)
IsNull(expression)
IsNumeric(expression)
IsObject(identifier)
TypeName(varname)
VarType(varname)
DESCRIPTION
Returns a user-defined error number.
Returns the error message for the specified error number.
Indicates whether a variable contains an array.
Indicates whether an expression contains a date.
Indicates whether a variable has been initialized.
Indicates whether an expression is an error value.
Indicates whether an optional argument was passed to a
procedure.
Indicates whether an expression contains no valid data.
Indicates whether an expression is a number.
Indicates whether a variable references an object.
Specifies the variable type.
Specifies the subtype of a variable.
Interaction Functions
FUNCTION
DESCRIPTION
RETURNS
VBA KOMUTLARI
Boolean
Boolean
Boolean
Boolean
String
Integer
6/17
Mathematical Functions
FUNCTION
Abs(number)
Atn(number)
Cos(number)
String
Variant
Variant
Variant
Integer
String
Long
Variant
Long
Exp(number)
DESCRIPTION
Returns the absolute value of a number.
Returns the arctangent of a number.
Returns the cosine of an angle.
Returns the base of the natural logarithms raised to a
power.
Fix(number)
Int(number)
Log(number)
Round(expression [,
numdecimalplaces])
Rnd[(number)]
Sgn(number)
Sin(number)
Sqr(number)
Tan(number)
DESCRIPTION
RETURNS
Mixed
Double
Double
Double
Integer
Double
Mixed
Single
Integer
Double
Double
Double
RETURNS
7/17
VBA KOMUTLARI
String
Long
String
String
String
String
String
String
String
Integer
String
String
String
String
String
8/17
VALUE
2
DESCRIPTION
Displays Abort, Retry, and Ignore buttons.
vbApplicationModal
vbCritical
16
vbDefaultButton1
vbDefaultButton2
vbDefaultButton3
vbDefaultButton4
vbExclamation
0
256
512
768
48
vbInformation
64
vbMsgBoxHelpButton
vbMsgBoxRight
vbMsgBoxRtlReading
16384
524288
1048576
vbMsgBoxSetForeground
65536
vbOKCancel
vbOKOnly
vbQuestion
vbRetryCancel
0
32
5
vbSystemModal
4096
vbYesNo
vbYesNoCancel
4
3
vbDayOfWeek Constants
CONSTANT
vbUseSystemDayofWeek
vbSunday
vbMonday
vbTuesday
vbWednesday
vbThursday
vbFriday
vbSaturday
VALUE
0
1
2
3
4
5
6
7
DESCRIPTION
Uses the system defined first day of week
Sunday (default)
Monday
Tuesday
Wednesday
Thursday
Friday
Saturday
vbFirstWeekOfYear Constants
CONSTANT
VALUE
vbUseSystem
0
VBA KOMUTLARI
DESCRIPTION
Uses system defined first week of year.
9/17
vbFirstJan1
vbFirstFourDays
vbFirstFullWeek
DISPLAYS
Day with no leading zero.
Three-letter abbreviation of day (Sun. Sat.).
Full day name (Sunday).
Complete date using short date format.
Complete date using long date format.
Day of week as number (1 for Sunday).
Week of year as number.
Month with no leading zero.
Three letter abbreviation of month (Jan.-Dec.).
Complete month name.
Quarter of year.
Day of year as number.
Year as 2-digit number.
Year as 4-digit number.
Hour with no leading zero.
Minutes with no leading zero.
Seconds with no leading zero.
Complete time using system time format.
Date as dddddd and time as ttttt.
VALUE
DESCRIPTION
4 DMY format date
10/17
xlDYMFormat
xlEMDFormat
xlGeneralFormat
xlMDYFormat
xlMYDFormat
xlSkipColumn
xlTextFormat
xlYDMFormat
xlYMDFormat
VALUE
DESCRIPTION
4 DMY format date
7 DYM format date
10 EMD format date
1 General format
3 MDY format date
6 MYD format date
9 Skip Column
2 Text format
8 YDM format date
5 YMD format date
XlFileFormat Constants
CONSTANT
VALUE DESCRIPTION
xlAddIn
18 Excel add-in.
xlCSV
6 Comma-separated values format.
xlCSVMac
22 Macintosh comma-separated values format.
xlCSVMSDOS
24 MSDOS comma-separated values format.
xlCSVWindows
23 MS Windows comma-separated values format.
xlCurrentPlatformText
-4158 Text file based on current operating system.
xlDBF2
7 DBase II format.
VBA KOMUTLARI
11/17
xlDBF3
xlDBF4
xlDIF
xlExcel2
xlExcel2FarEast
xlExcel3
xlExcel4
xlExcel4Workbook
xlExcel5
xlExcel7
xlExcel9795
xlHtml
xlIntlAddIn
xlIntlMacro
xlSYLK
xlTemplate
xlTextMac
xlTextMSDOS
xlTextPrinter
xlTextWindows
xlUnicodeText
xlWebArchive
xlWK1
xlWK1ALL
xlWK1FMT
xlWK3
xlWK3FM3
xlWK4
xlWKS
xlWorkbookNormal
xlWorks2FarEast
xlWQ1
xlXMLSpreadsheet
MsoFileType Constants
CONSTANT
VALUE DESCRIPTION
msoFileTypeAllFiles
1 All file types.
msoFileTypeBinders
6 Microsoft Office Binder file.
msoFileTypeCalendarItem
11 Microsoft Outlook Calendar item.
msoFileTypeContactItem
12 Microsoft Outlook Contact item.
msoFileTypeDatabases
7 Database files.
msoFileTypeDataConnectionFiles
17 Database connection files.
msoFileTypeDesignerFiles
22 Designer files.
msoFileTypeDocumentImagingFiles
20 Document imaging files.
msoFileTypeExcelWorkbooks
4 Microsoft Excel Workbooks.
msoFileTypeJournalItem
14 Journal items.
msoFileTypeMailItem
10 Microsoft Outlook Mail message.
msoFileTypeNoteItem
13 Microsoft Outlook Note item.
msoFileTypeOfficeFiles
2 All Microsoft Office file types.
msoFileTypeOutlookItems
9 Microsoft Outlook files.
msoFileTypePhotoDrawFiles
16 Microsoft PhotoDraw files.
msoFileTypePowerPointPresentations
5 Microsoft PowerPoint files.
msoFileTypeProjectFiles
19 Microsoft Project files.
msoFileTypePublisherFiles
18 Microsoft Publisher files.
VBA KOMUTLARI
12/17
msoFileTypeTaskItem
msoFileTypeTemplates
msoFileTypeVisioFiles
msoFileTypeWebPages
msoFileTypeWordDocuments
XlChartType Constants
CONSTANT
xl3DArea
xl3DAreaStacked
xl3DAreaStacked100
xl3DBarClustered
xl3DBarStacked
xl3DBarStacked100
xl3DColumn
xl3DColumnClustered
xl3DColumnStacked
xl3DColumnStacked100
xl3DLine
xl3DPie
xl3DPieExploded
xlArea
xlAreaStacked
xlAreaStacked100
xlBarClustered
xlBarOfPie
xlBarStacked
xlBarStacked100
xlBubble
xlBubble3DEffec
xlColumnClustered
xlColumnStacked
xlColumnStacked100
xlConeBarClustered
xlConeBarStacked
xlConeBarStacked100
xlConeCol
xlConeColClustered
xlConeColStacked
xlConeColStacked100
xlCylinderBarClustered
xlCylinderBarStacked
xlCylinderBarStacked100
xlCylinderCol
xlCylinderColClustered
xlCylinderColStacked
xlCylinderColStacked100
xlDoughnut
xlDoughnutExploded
xlLine
xlLineMarkers
xlLineMarkersStacked
xlLineMarkersStacked100
xlLineStacked
VBA KOMUTLARI
13/17
xlLineStacked100
xlPie
xlPieExploded
xlPieOfPie
xlPyramidBarClustered
xlPyramidBarStacked
xlPyramidBarStacked100
xlPyramidCol
xlPyramidColClustered
xlPyramidColStacked
xlPyramidColStacked100
xlRadar
xlRadarFilled
xlRadarMarkers
xlStockHLC
xlStockOHLC
xlStockVHLC
xlStockVOHLC
xlSurface
xlSurfaceTopView
xlSurfaceTopViewWireframe
xlSurfaceWireframe
xlXYScatter
xlXYScatterLines
xlXYScatterLinesNoMarkers
xlXYScatterSmooth
xlXYScatterSmoothNoMarkers
XlLineStyle Constants
CONSTANT
VALUE
DESCRIPTION
xlContinuous
1 Continuous solid line.
xlDash
4155 Dashed line.
xlDashDot
4 Line with the pattern dash dot.
xlDashDotDot
5 Line with the pattern dash dot dot.
xlDot
4118 Dotted line.
xlDouble
4119 Double solid line.
xlSlantDashDot
13 Slanted line with the pattern dash dot.
xlineStyleNone
4142 No line.
XlBorderWeight Constants
CONSTANT
VALUE
DESCRIPTION
xlHairline
1 Creates a very thin line.
xlMedium
-4138 Creates a medium width line.
xlThick
4 Creates a thick line.
xlThin
2 Creates a thin line.
XlPattern Constants
CONSTANT
xlPatternAutomatic
xlPatternChecker
xlPatternCrissCross
xlPatternDown
xlPatternGray16
VBA KOMUTLARI
VALUE
DESCRIPTION
-4105 System default.
9 Checkered pattern.
16 Criss-cross pattern.
-4121 Downward pattern.
17 16% gray pattern.
14/17
xlPatternGray25
xlPatternGray50
xlPatternGray75
xlPatternGray8
xlPatternGrid
xlPatternHorizontal
xlPatternLightHorizontal
xlPatternLightVertical
xlPatternLightDown
xlPatternLightUp
xlPatternNone
xlPatternSemiGray75
xlPatternSolid
xlPatternUp
xlPatternVertical
Excel CommandBars
CONSTANT
NAME
1
Worksheet Menu Bar
2
Chart Menu Bar
3
Standard
4
Formatting
5
PivotTable
6
Chart
7
Reviewing
8
Forms
9
Stop Recording
10
External Data
11
Formula Auditing
12
Full Screen
13
Circular Reference
14
Visual Basic
15
Web
16
Control Toolbox
17
Exit Design Mode
18
Refresh
19
Watch Window
20
PivotTable Field List
21
Borders
22
Protection
23
Text To Speech
24
Drawing
25
Query and Pivot
26
PivotChart Menu
27
Workbook tabs
28
Cell
29
Column
30
Row
31
Cell
32
Column
33
Row
34
Ply
35
XLM Cell
VBA KOMUTLARI
TYPE
Menu Bar
Menu Bar
Toolbar
Toolbar
Toolbar
Toolbar
Toolbar
Toolbar
Toolbar
Toolbar
Toolbar
Toolbar
Toolbar
Toolbar
Toolbar
Toolbar
Toolbar
Toolbar
Toolbar
Toolbar
Toolbar
Toolbar
Toolbar
Toolbar
Shortcut Menu
Shortcut Menu
Shortcut Menu
Shortcut Menu
Shortcut Menu
Shortcut Menu
Shortcut Menu
Shortcut Menu
Shortcut Menu
Shortcut Menu
Shortcut Menu
15/17
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
VBA KOMUTLARI
Document
Desktop
Nondefault Drag and Drop
AutoFill
Button
Dialog
Series
Plot Area
Floor and Walls
Trendline
Chart
Format Data Series
Format Axis
Format Legend Entry
Formula Bar
PivotTable Context Menu
Query
Query Layout
AutoCalculate
Object/Plot
Title Bar (Charting)
Layout
Pivot Chart Popup
Phonetic Information
Auto Sum
Paste Special Dropdown
Find Format
Replace Format
WordArt
Picture
Shadow Settings
3-D Settings
Drawing Canvas
Organization Chart
Diagram
Borders
Borders
Draw Border
Chart Type
Pattern
Font Color
Fill Color
Line Color
Order
Nudge
Align or Distribute
Rotate or Flip
Lines
Connectors
AutoShapes
Callouts
Flowchart
Block Arrows
Stars & Banners
Basic Shapes
Shortcut Menu
Shortcut Menu
Shortcut Menu
Shortcut Menu
Shortcut Menu
Shortcut Menu
Shortcut Menu
Shortcut Menu
Shortcut Menu
Shortcut Menu
Shortcut Menu
Shortcut Menu
Shortcut Menu
Shortcut Menu
Shortcut Menu
Shortcut Menu
Shortcut Menu
Shortcut Menu
Shortcut Menu
Shortcut Menu
Shortcut Menu
Shortcut Menu
Shortcut Menu
Shortcut Menu
Shortcut Menu
Shortcut Menu
Shortcut Menu
Shortcut Menu
Toolbar
Toolbar
Toolbar
Toolbar
Toolbar
Toolbar
Toolbar
Toolbar
Toolbar
Toolbar
Toolbar
Toolbar
Toolbar
Toolbar
Toolbar
Toolbar
Toolbar
Toolbar
Toolbar
Toolbar
Toolbar
Toolbar
Toolbar
Toolbar
Toolbar
Toolbar
Toolbar
16/17
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
VBA KOMUTLARI
Insert Shape
Shapes
Inactive Chart
Excel Control
Curve
Curve Node
Curve Segment
Pictures Context Menu
OLE Object
ActiveX Control
WordArt Context Menu
Rotate Mode
Connector
Script Anchor Popup
Canvas Popup
Organization Chart Popup
Diagram
Layout
Select
Task Pane
Add Command
Built-in Menus
System
Clipboard
Envelope
Online Meeting
Toolbar
Shortcut Menu
Shortcut Menu
Shortcut Menu
Shortcut Menu
Shortcut Menu
Shortcut Menu
Shortcut Menu
Shortcut Menu
Shortcut Menu
Shortcut Menu
Shortcut Menu
Shortcut Menu
Shortcut Menu
Shortcut Menu
Shortcut Menu
Shortcut Menu
Shortcut Menu
Shortcut Menu
Toolbar
Shortcut Menu
Shortcut Menu
Shortcut Menu
Toolbar
Toolbar
Toolbar
17/17