Skip to content

Commit 87d0f3c

Browse files
committed
Revert "[admin] merge changes"
This reverts commit 08fd6af.
1 parent a8d7272 commit 87d0f3c

File tree

64 files changed

+1442
-193
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+1442
-193
lines changed

Language/Reference/User-Interface-Help/atn-function.md

+4-17
Original file line numberDiff line numberDiff line change
@@ -24,29 +24,16 @@ The required _number_ [argument](../../Glossary/vbe-glossary.md#argument) is a [
2424

2525
The **Atn** function takes the ratio of two sides of a right triangle (_number_) and returns the corresponding angle in radians. The ratio is the length of the side opposite the angle divided by the length of the side adjacent to the angle.
2626

27+
> [NOTE!]
28+
> This is the equivalent of the **ATAN()** function in Excel. Oddly, **Excel.WorksheetFunctions.ATAN()** does not exist (as with other Excel formula functions). You can instead use this VBA **Atn()** function.
29+
2730
The range of the result is **-**[pi](../../Glossary/vbe-glossary.md#pi)/2 to pi/2 radians. To convert degrees to radians, multiply degrees by pi/180. To convert radians to degrees, multiply radians by 180/pi.
2831

2932
> [!NOTE]
3033
> **Atn** is the inverse trigonometric function of **[Tan](tan-function.md)**, which takes an angle as its argument and returns the ratio of two sides of a right triangle. Do not confuse **Atn** with the cotangent, which is the simple inverse of a tangent (1/tangent).
3134
32-
33-
## Example
34-
35-
This example uses the **Atn** function to calculate the value of pi.
36-
37-
38-
```vb
39-
Dim IntVar, StrVar, DateVar, MyCheck
40-
' Initialize variables.
41-
IntVar = 459: StrVar = "Hello World": DateVar = #2/12/69#
42-
MyCheck = VarType(IntVar) ' Returns 2.
43-
MyCheck = VarType(DateVar) ' Returns 7.
44-
MyCheck = VarType(StrVar) ' Returns 8.
45-
46-
```
47-
4835
## See also
4936

5037
- [Functions (Visual Basic for Applications)](../functions-visual-basic-for-applications.md)
5138

52-
[!include[Support and feedback](~/includes/feedback-boilerplate.md)]
39+
[!include[Support and feedback](~/includes/feedback-boilerplate.md)]

Language/Reference/User-Interface-Help/copyfile-method.md

+6
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,12 @@ If _source_ contains wildcard characters, or _destination_ ends with a path sepa
5858

5959
An error also occurs if a _source_ using wildcard characters doesn't match any files. The **CopyFile** method stops on the first error it encounters. No attempt is made to roll back or undo any changes made before an error occurs.
6060

61+
Files copied to a new destination path will keep the same file name. To rename the copied file, simply include the new file name in the destination path. For example, this will copy the file to a new location _and_ the file in the new location will have a different name:
62+
63+
```vb
64+
FileSystemObject.CopyFile "c:\mydocuments\letters\sample.doc", "c:\tempfolder\sample_new.doc"
65+
```
66+
6167
## See also
6268

6369
- [Objects (Visual Basic for Applications)](../objects-visual-basic-for-applications.md)

Language/Reference/User-Interface-Help/createobject-function.md

+2
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ Set xlApp = CreateObject("excel.application")
126126
xlApp.Visible = True
127127
' Use xlApp to access Microsoft Excel's
128128
' other objects.
129+
' Closes the application using the Quit method
130+
xlApp.Quit
129131

130132
```
131133

Language/Reference/User-Interface-Help/like-operator.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ MyCheck = "aBBBa" Like "a*a" ' Returns True.
8787
MyCheck = "F" Like "[A-Z]" ' Returns True.
8888
MyCheck = "F" Like "[!A-Z]" ' Returns False.
8989
MyCheck = "a2a" Like "a#a" ' Returns True.
90-
MyCheck = "aM5b" Like "a [L-P]#[!c-e]" ' Returns True.
90+
MyCheck = "aM5b" Like "a[L-P]#[!c-e]" ' Returns True.
9191
MyCheck = "BAT123khg" Like "B?T*" ' Returns True.
9292
MyCheck = "CAT123khg" Like "B?T*" ' Returns False.
9393
MyCheck = "ab" Like "a*b" ' Returns True.

Language/Reference/User-Interface-Help/split-function.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Dim strSingleString2 As String
5353
Dim strSingleString3 As String
5454
Dim i As Long
5555

56-
strFull = "Some - Old - Hags - Can - Always - Hide - Their - Old - Age" ' String that will be used.
56+
strFull = "Dow - Fonseca - Graham - Kopke - Noval - Offley - Sandeman - Taylor - Warre" ' String that will be used.
5757

5858
arrSplitStrings1 = Split(strFull, "-") ' arrSplitStrings1 will be an array from 0 To 8.
5959
' arrSplitStrings1(0) = "Some " and arrSplitStrings1(1) = " Old ".

Language/Reference/User-Interface-Help/variant-data-type.md

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ The **Variant** data type has no [type-declaration character](../../Glossary/vbe
1818

1919
A **Variant** is a special data type that can contain any kind of data except fixed-length [String](../../Glossary/vbe-glossary.md#string-data-type) data. (**Variant** types now support [user-defined types](../../Glossary/vbe-glossary.md#user-defined-type).) A **Variant** can also contain the special values [Empty](../../Glossary/vbe-glossary.md#empty), **Error**, **Nothing**, and [Null](../../Glossary/vbe-glossary.md#null). You can determine how the data in a **Variant** is treated by using the **VarType** function or **TypeName** function.
2020

21+
Use the [VarType function](https://docs.microsoft.com/office/vba/language/reference/user-interface-help/vartype-function) to test what type of data is held in a Variant.
22+
2123
Numeric data can be any integer or real number value ranging from -1.797693134862315E308 to -4.94066E-324 for negative values and from 4.94066E-324 to 1.797693134862315E308 for positive values.
2224

2325
Generally, numeric **Variant** data is maintained in its original data type within the **Variant**. For example, if you assign an [Integer](../../Glossary/vbe-glossary.md#integer-data-type) to a **Variant**, subsequent operations treat the **Variant** as an **Integer**. However, if an arithmetic operation is performed on a **Variant** containing a [Byte](../../Glossary/vbe-glossary.md#byte-data-type), an **Integer**, a [Long](../../Glossary/vbe-glossary.md#long-data-type), or a [Single](../../Glossary/vbe-glossary.md#single-data-type), and the result exceeds the normal range for the original data type, the result is promoted within the **Variant** to the next larger data type. A **Byte** is promoted to an **Integer**, an **Integer** is promoted to a **Long**, and a **Long** and a **Single** are promoted to a [Double](../../Glossary/vbe-glossary.md#double-data-type).

README.md

+13-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
# About VBA-docs repo
2+
We no longer have resources to respond to new issues. We welcome PRs that include documentation fixes, code samples, or improved comments. Please create a branch, make your changes, then open a PR to merge your change to master. We try to review new PRs monthly, but you can tag @lindalu-MSFT in a comment for faster response!
3+
4+
## Get Office VBA support on Microsoft Q&A
5+
There is a new forum on Microsoft Q&A for your VBA questions. To ask the developer community questions about your VBA code, go to the [Microsoft Q&A office-vba-dev forum](https://docs.microsoft.com/en-us/answers/questions/topics/single/192523.html).
6+
7+
## Join the Microsoft 365 Developer Program
8+
Get a free sandbox, tools, and other resources you need to build solutions for the Microsoft 365 platform.
9+
- [Free developer sandbox](https://developer.microsoft.com/microsoft-365/dev-program#Subscription) Get a free, renewable 90-day Microsoft 365 E5 developer subscription.
10+
- [Sample data packs](https://developer.microsoft.com/microsoft-365/dev-program#Sample) Automatically configure your sandbox by installing user data and content to help you build your solutions.
11+
- [Access to experts](https://developer.microsoft.com/microsoft-365/dev-program#Experts) Access community events to learn from Microsoft 365 experts.
12+
- [Personalized recommendations](https://developer.microsoft.com/microsoft-365/dev-program#Recommendations) Find developer resources quickly from your personalized dashboard.
13+
114
## Microsoft Open Source Code of Conduct
215

316
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
@@ -7,4 +20,3 @@ For more information, see the [Code of Conduct FAQ](https://opensource.microsoft
720
The live docs for this repo can be accessed at https://docs.microsoft.com/office/vba/api/overview/.
821

922
For information about how to contribute to this documentation, see [Contributing](contributing.md).
10-

access/Concepts/Miscellaneous/ado-for-visual-c-plus-plus-syntax-index-for-com.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
title: ADO for Visual C++ syntax index for COM
33
ms.prod: access
44
ms.assetid: e016746e-07a8-10a1-b8e4-7dbb7f6cdaf2
5-
ms.date: 10/12/2018
5+
ms.date: 05/12/2021
66
localization_priority: Normal
77
---
88

99

1010
# ADO for Visual C++ syntax index for COM
1111

12-
**Applies to:** Access 2013 | Access 2016
12+
**Applies to:** Access 2013 | Access 2016 | Access 2019
1313

1414
This index is a cross-reference to the ADO Language Reference based on Microsoft Visual C++.
1515

@@ -31,7 +31,7 @@ Method and property syntax in Visual C++ is listed for the following elements:
3131

3232
## See also
3333

34-
- [Access for developers forum](https://social.msdn.microsoft.com/Forums/office/home?forum=accessdev)
34+
- [Access for developers forum on Microsoft Q&A](https://docs.microsoft.com/answers/topics/office-access-dev.html)
3535
- [Access help on support.office.com](https://support.office.com/search/results?query=Access)
3636
- [Access help on answers.microsoft.com](https://answers.microsoft.com/)
3737
- [Access forums on UtterAccess](https://www.utteraccess.com/forum/index.php?act=idx)

api/Access.AcFileFormat.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ Specifies the Microsoft Access file format to use when converting an Access file
2020

2121
|Name|Value|Description|
2222
|:-----|:-----|:-----|
23-
|**acFileFormatAccess12**|12|Microsoft Access 2007 format|
2423
|**acFileFormatAccess2**|2|Microsoft Access 2.0 format|
25-
|**acFileFormatAccess2000**|9|Microsoft Access 2000 format|
26-
|**acFileFormatAccess2002**|10|Microsoft Access 2002 format|
2724
|**acFileFormatAccess95**|7|Microsoft Access 95 format|
2825
|**acFileFormatAccess97**|8|Microsoft Access 97 format|
26+
|**acFileFormatAccess2000**|9|Microsoft Access 2000 format|
27+
|**acFileFormatAccess2002**|10|Microsoft Access 2002 format|
28+
|**acFileFormatAccess2007**|12|Microsoft Access 2007 format|
2929

30-
[!include[Support and feedback](~/includes/feedback-boilerplate.md)]
30+
[!include[Support and feedback](~/includes/feedback-boilerplate.md)]

api/Access.Application.Nz.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Variant
3838

3939
## Remarks
4040

41-
If the _Value_ of the variant argument is **Null**, the **Nz** function returns an unassigned **Variant**, the special value **[Empty](../language/glossary/vbe-glossary#empty)**. In VBA, **Empty** evaluates to the number zero or a zero-length string, depending on whether the context indicates that the _Value_ should be a number or a string. For example:
41+
If the _Value_ of the variant argument is **Null**, the **Nz** function returns an unassigned **Variant**, the special value **[Empty](../language/glossary/vbe-glossary.md#empty)**. In VBA, **Empty** evaluates the number zero or a zero-length string, depending on whether the context indicates that the _Value_ should be a number or a string. For example:
4242

4343
```vb
4444
Nz(Null) + 2 ' returns 2
@@ -47,7 +47,7 @@ Nz(Null) + "2" ' returns "2"
4747
Nz(Null) & "2" ' returns "2"
4848
```
4949

50-
When used in a query expression, however, **Nz** always returns a zero-length string.
50+
When used in a query expression, **Nz** will return similar result values.
5151

5252
If the optional _ValueIfNull_ argument is included, the **Nz** function will return the value specified by that argument if the variant argument is **Null**.
5353

api/Access.DoCmd.Hourglass.md

+2
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ You often use this method if you've turned echo off by using the **Echo** method
3838

3939
Access automatically resets the _HourglassOn_ argument to **False** when the procedure finishes running.
4040

41+
To determine the current state of the hourglass, you can check the value of [Screen.MousePointer](https://docs.microsoft.com/office/vba/api/access.screen.mousepointer). If `Screen.MousePointer = 11`, the hourglass is currently being displayed.
42+
4143

4244

4345
[!include[Support and feedback](~/includes/feedback-boilerplate.md)]

api/Access.DoCmd.SendObject.md

+6-14
Original file line numberDiff line numberDiff line change
@@ -87,23 +87,19 @@ Public Function CreateEmailWithOutlook( _
8787

8888
' Define app variable and get Outlook using the "New" keyword
8989
Dim olApp As New Outlook.Application
90-
Dim olMailItem As Outlook.MailItem ' An Outlook Mail item
90+
Dim olEmail As Outlook.MailItem ' An Outlook Mail item
9191

9292
' Create a new email object
93-
Set olMailItem = olApp.CreateItem(olMailItem)
93+
Set olEmail = olApp.CreateItem(olMailItem)
9494

9595
' Add the To/Subject/Body to the message and display the message
96-
With olMailItem
96+
With olEmail
9797
.To = MessageTo
9898
.Subject = Subject
9999
.Body = MessageBody
100100
.Display ' To show the email message to the user
101101
End With
102102

103-
' Release all object variables
104-
Set olMailItem = Nothing
105-
Set olApp = Nothing
106-
107103
End Function
108104
```
109105

@@ -119,23 +115,19 @@ Public Function SendEmailWithOutlook( _
119115

120116
' Define app variable and get Outlook using the "New" keyword
121117
Dim olApp As New Outlook.Application
122-
Dim olMailItem As Outlook.MailItem ' An Outlook Mail item
118+
Dim olEmail As Outlook.MailItem ' An Outlook Mail item
123119

124120
' Create a new email object
125-
Set olMailItem = olApp.CreateItem(olMailItem)
121+
Set olEmail = olApp.CreateItem(olMailItem)
126122

127123
' Add the To/Subject/Body to the message and display the message
128-
With olMailItem
124+
With olEmail
129125
.To = MessageTo
130126
.Subject = Subject
131127
.Body = MessageBody
132128
.Send ' Send the message immediately
133129
End With
134130

135-
' Release all object variables
136-
Set olMailItem = Nothing
137-
Set olApp = Nothing
138-
139131
End Function
140132
```
141133

api/Access.Module.ProcStartLine.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,17 @@ The _ProcKind_ argument can be one of the following **vbext_ProcKind** constants
4040
|**vbext_pk_Get**|A **Property Get** procedure.|
4141
|**vbext_pk_Let**|A **Property Let** procedure.|
4242
|**vbext_pk_Proc**|A **Sub** or **Function** procedure.|
43-
|**vbext_pk_Set**|A **Property Se** t procedure.|
43+
|**vbext_pk_Set**|A **Property Set** procedure.|
4444

45-
A procedure begins with any comments and compilation constants that immediately precede the procedure definition, denoted by one of the following:
45+
A procedure begins with any blank lines, comments and compilation constants that immediately precede the procedure definition, denoted by one of the following:
4646

4747
- A **Sub** statement
4848
- A **Function** statement
4949
- A **Property Get** statement
5050
- A **Property Let** statement
5151
- A **Property Set** statement
5252

53-
The **ProcStartLine** property returns the number of the line on which the specified procedure begins. The beginning of the procedure may include comments or compilation constants that precede the procedure definition.
53+
The **ProcStartLine** property returns the number of the line on which the specified procedure begins. The beginning of the procedure may include blank lines, comments or compilation constants that precede the procedure definition.
5454

5555
To determine the line on which the procedure definition begins, use the **[ProcBodyLine](Access.Module.ProcBodyLine.md)** property. This property returns the number of the line that begins with a **Sub**, **Function**, **Property Get**, **Property Let**, or **Property Set** statement.
5656

@@ -59,7 +59,7 @@ The **ProcStartLine** and **ProcBodyLine** properties can have the same value if
5959
It may be easier to determine where a procedure begins if you have the **Procedure Separator** option selected. With this option selected, there is a line between the end of a procedure and the beginning of the next procedure. The first line of code (or blank line) below the procedure separator is the first line of the following procedure, which is the line returned by the **ProcStartLine** property. The **Procedure Separator** option is located on the **Editor** tab of the **Options** dialog box, available by choosing **Options** on the **Tools** menu.
6060

6161
> [!NOTE]
62-
> The **ProcStartLine** property treats **Sub** and **Function** procedures similarly, but distinguishes between each type of Property procedure.
62+
> The **ProcStartLine** property treats **Sub** and **Function** procedures similarly, but distinguishes between each type of **Property** procedure.
6363
6464

6565
## Example
@@ -79,4 +79,4 @@ MsgBox "The procedure " & strProc & " starts on line " & _
7979

8080

8181

82-
[!include[Support and feedback](~/includes/feedback-boilerplate.md)]
82+
[!include[Support and feedback](~/includes/feedback-boilerplate.md)]

api/Access.RowSourceType.md

+62-52
Original file line numberDiff line numberDiff line change
@@ -63,26 +63,32 @@ The following user-defined function returns a list of the next four Mondays foll
6363

6464

6565
```vb
66-
Function ListMondays(fld As Control,id As Variant, _
67-
row As Variant,col As Variant,code As Variant) _
68-
As Variant
69-
Dim intOffset As Integer
70-
Select Case code
71-
Case acLBInitialize ' Initialize.
72-
ListMondays = True
73-
Case acLBOpen ' Open.
74-
ListMondays = Timer ' Unique ID.
75-
Case acLBGetRowCount ' Get rows.
76-
ListMondays = 4
77-
Case acLBGetColumnCount ' Get columns.
78-
ListMondays = 1
79-
Case acLBGetColumnWidth ' Get column width.
80-
ListMondays = -1 ' Use default width.
81-
Case acLBGetValue ' Get the data.
82-
intOffset = Abs((9 - Weekday(Now))Mod 7)
83-
ListMondays = Format(Now() + _
84-
intOffset + 7 * row,"mmmm d")
85-
End Select
66+
Public Function ListMondays(fld As Control, id As Variant, _
67+
row As Variant, col As Variant, code As Variant) _
68+
As Variant
69+
70+
Dim Offset As Integer
71+
Dim WeekdayDate As Date
72+
73+
Select Case code
74+
Case acLBInitialize ' Initialize.
75+
ListMondays = True
76+
Case acLBOpen ' Open.
77+
ListMondays = Timer ' Unique ID.
78+
Case acLBGetRowCount ' Get rows.
79+
ListMondays = 4
80+
Case acLBGetColumnCount ' Get columns.
81+
ListMondays = 1
82+
Case acLBGetColumnWidth ' Get column width.
83+
ListMondays = -1 ' Use default width.
84+
Case acLBGetValue ' Get the data.
85+
Offset = Abs((9 - Weekday(Date)) Mod 7)
86+
WeekdayDate = DateAdd("d", _
87+
Offset + 7 * row, Date)
88+
ListMondays = Format(WeekdayDate, _
89+
"mmmm d")
90+
End Select
91+
8692
End Function
8793
```
8894

@@ -91,39 +97,43 @@ End Function
9197
The next example uses a static array to store the names of the databases in the current directory. To call this function, enter **ListMDBs** as the **RowSourceType** property setting and leave the **RowSource** property setting blank.
9298

9399
```vb
94-
Function ListMDBs(fld As Control, id As Variant, _
95-
row As Variant, col As Variant, _
96-
code As Variant) As Variant
97-
Static dbs(127) As String, Entries As Integer
98-
Dim ReturnVal As Variant
99-
ReturnVal = Null
100-
Select Case code
101-
Case acLBInitialize ' Initialize.
102-
Entries = 0
103-
dbs(Entries ) = Dir("*.MDB")
104-
Do Until dbs(Entries) = "" Or Entries >= 127
105-
Entries = Entries+1
106-
dbs(Entries) = Dir
107-
Loop
108-
ReturnVal = Entries
109-
Case acLBOpen ' Open.
110-
' Generate unique ID for control.
111-
ReturnVal = Timer
112-
Case acLBGetRowCount ' Get number of rows.
113-
ReturnVal = Entries
114-
Case acLBGetColumnCount ' Get number of columns.
115-
ReturnVal = 1
116-
Case acLBGetColumnWidth ' Column width.
117-
' -1 forces use of default width.
118-
ReturnVal = -1
119-
Case acLBGetValue ' Get data.
120-
ReturnVal = dbs(row)
121-
Case acLBEnd ' End.
122-
Erase dbs
123-
End Select
124-
ListMDBs = ReturnVal
100+
Public Function ListMDBs(fld As Control, id As Variant, _
101+
row As Variant, col As Variant, code As Variant) _
102+
As Variant
103+
104+
Static dbs(127) As String
105+
Static Entries As Integer
106+
Dim ReturnVal As Variant
107+
108+
ReturnVal = Null
109+
Select Case code
110+
Case acLBInitialize ' Initialize.
111+
Entries = 0
112+
dbs(Entries ) = Dir("*.MDB")
113+
Do Until dbs(Entries) = "" Or Entries >= 127
114+
Entries = Entries + 1
115+
dbs(Entries) = Dir
116+
Loop
117+
ReturnVal = Entries
118+
Case acLBOpen ' Open.
119+
' Generate unique ID for control.
120+
ReturnVal = Timer
121+
Case acLBGetRowCount ' Get number of rows.
122+
ReturnVal = Entries
123+
Case acLBGetColumnCount ' Get number of columns.
124+
ReturnVal = 1
125+
Case acLBGetColumnWidth ' Column width.
126+
' -1 forces use of default width.
127+
ReturnVal = -1
128+
Case acLBGetValue ' Get data.
129+
ReturnVal = dbs(row)
130+
Case acLBEnd ' End.
131+
Erase dbs
132+
End Select
133+
ListMDBs = ReturnVal
134+
125135
End Function
126136
```
127137

128138

129-
[!include[Support and feedback](~/includes/feedback-boilerplate.md)]
139+
[!include[Support and feedback](~/includes/feedback-boilerplate.md)]

0 commit comments

Comments
 (0)