Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
1a7c8de
Fixed table formatting
Aug 29, 2018
0e00760
migrate old PRs from VBA-content to VBA-docs
lindalu-MSFT Aug 31, 2018
642ad91
Merge pull request #92 from MicrosoftDocs/lindalu-migrate-old-prs
lindalu-MSFT Aug 31, 2018
546f150
Clarification added to return values table.
Reezaali Aug 31, 2018
8de89d7
Merge pull request #98 from Reezaali/patch-1
lindalu-MSFT Aug 31, 2018
ae3f6e0
Updated links
Sep 5, 2018
fce2e94
Lowercased enumeration
Sep 5, 2018
152ae9c
Fixed links
Sep 5, 2018
0d0040b
Changed "object", "property", "method" to lowercase
Sep 5, 2018
c3e1152
Updated capitalization
Sep 5, 2018
e5e171f
Updated date
Sep 5, 2018
e881c74
Added links
Sep 5, 2018
84aef9e
Made headings level 2
Sep 5, 2018
98a27f1
Changed heading level
Sep 5, 2018
f75a41f
Changed "(./" to "("
Sep 6, 2018
b7dba35
Update replace-function.md (#86)
GustavBrock Sep 6, 2018
08f82b7
Update let-statement.md (#89)
IvenBach Sep 6, 2018
a44eed7
Add missing spaces to set-statement.md (#90)
IvenBach Sep 6, 2018
e2eadb8
Update opentextfile-method.md: fix code sample and another minor amen…
dhgutteridge Sep 6, 2018
317efc2
Update Excel.Application.OnUndo.md (#96)
IvenBach Sep 6, 2018
fded3b6
Correct Excel.Application.OnRepeat.md punctuation (#97)
IvenBach Sep 6, 2018
f2c57a8
Update rnd-function.md (#112)
GustavBrock Sep 6, 2018
2b130f2
Changed "About the contributor" headings to level 3 (#117)
italicize Sep 6, 2018
94a1f53
Removed redundant "Enumeration"
Sep 6, 2018
3eec04b
Merge branch 'live' into master
Sep 6, 2018
a40c4a8
Update format-function-visual-basic-for-applications.md (#135)
GustavBrock Sep 7, 2018
6d08d75
Removed duplicate description
Sep 7, 2018
73a5195
Removed duplicate description
Sep 7, 2018
9c08f62
Lowercased "members"
Sep 7, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions Language/Reference/User-Interface-Help/let-statement.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ ms.date: 06/08/2017

# Let Statement

Assigns the value of an [expression](../../Glossary/vbe-glossary.md#expression) to a[variable](../../Glossary/vbe-glossary.md#variable) or[property](../../Glossary/vbe-glossary.md#property).
Assigns the value of an [expression](../../Glossary/vbe-glossary.md#expression) to a [variable](../../Glossary/vbe-glossary.md#variable) or [property](../../Glossary/vbe-glossary.md#property).

## Syntax

Expand All @@ -28,10 +28,10 @@ The **Let** statement syntax has these parts:

## Remarks

A value expression can be assigned to a variable or property only if it is of a [data type](../../Glossary/vbe-glossary.md#data-type) that is compatible with the variable. You can't assign[string expressions](../../Glossary/vbe-glossary.md#string-expression) to numeric variables, and you can't assign[numeric expressions](../../Glossary/vbe-glossary.md#numeric-expression) to string variables. If you do, an error occurs at[compile time](../../Glossary/vbe-glossary.md#compile-time).
[Variant](../../Glossary/vbe-glossary.md#variant-data-type) variables can be assigned either string or numeric expressions. However, the reverse is not always true. Any **Variant** except a[Null](../../Glossary/vbe-glossary.md#null) can be assigned to a string variable, but only a **Variant** whose value can be interpreted as a number can be assigned to a numeric variable. Use the **IsNumeric** function to determine if the **Variant** can be converted to a number.
A value expression can be assigned to a variable or property only if it is of a [data type](../../Glossary/vbe-glossary.md#data-type) that is compatible with the variable. You can't assign [string expressions](../../Glossary/vbe-glossary.md#string-expression) to numeric variables, and you can't assign [numeric expressions](../../Glossary/vbe-glossary.md#numeric-expression) to string variables. If you do, an error occurs at [compile time](../../Glossary/vbe-glossary.md#compile-time).
[Variant](../../Glossary/vbe-glossary.md#variant-data-type) variables can be assigned either string or numeric expressions. However, the reverse is not always true. Any **Variant** except a [Null](../../Glossary/vbe-glossary.md#null) can be assigned to a string variable, but only a **Variant** whose value can be interpreted as a number can be assigned to a numeric variable. Use the **IsNumeric** function to determine if the **Variant** can be converted to a number.
Assigning an expression of one [numeric type](../../Glossary/vbe-glossary.md#numeric-type) to a variable of a different numeric type coerces the value of the expression into the numeric type of the resulting variable.
**Let** statements can be used to assign one record variable to another only when both variables are of the same[user-defined type](../../Glossary/vbe-glossary.md#user-defined-type). Use the **LSet** statement to assign record variables of different user-defined types. Use the **Set** statement to assign object references to variables.
**Let** statements can be used to assign one record variable to another only when both variables are of the same [user-defined type](../../Glossary/vbe-glossary.md#user-defined-type). Use the **LSet** statement to assign record variables of different user-defined types. Use the **Set** statement to assign object references to variables.

## Example

Expand Down
6 changes: 3 additions & 3 deletions Language/Reference/User-Interface-Help/opentextfile-method.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ ms.date: 08/28/2018


**Description**
Opens a specified file and returns a **TextStream** object that can be used to read from or append to the file.
Opens a specified file and returns a **TextStream** object that can be used to read from, write to, or append to the file.


## Syntax
Expand Down Expand Up @@ -59,10 +59,10 @@ The following code illustrates the use of the **OpenTextFile** method to open a

```vb
Sub OpenTextFileTest
Const ForReading = 1, ForWriting = 2, ForAppending = 3
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim fs, f
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.OpenTextFile("c:\testfile.txt", ForAppending,TristateFalse)
Set f = fs.OpenTextFile("c:\testfile.txt", ForAppending, TristateFalse)
f.Write "Hello world!"
f.Close
End Sub
Expand Down
4 changes: 2 additions & 2 deletions Language/Reference/User-Interface-Help/replace-function.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ ms.date: 06/08/2017


**Description**
Returns a string in which a specified substring has been replaced with another substring a specified number of times.
Returns a string, which is a substring of a string expression beginning at the start position (defaults to 1), in which a specified substring has been replaced with another substring a specified number of times.

## Syntax

Expand All @@ -27,7 +27,7 @@ The **Replace** function syntax has these[named arguments](../../Glossary/vbe-g
|**_expression_**|Required. [String expression](../../Glossary/vbe-glossary.md#string-expression) containing substring to replace.|
|**_find_**|Required. Substring being searched for.|
|**_replace_**|Required. Replacement substring.|
|**_start_**|Optional. Position within **_expression_** where substring search is to begin. If omitted, 1 is assumed.|
|**_start_**|Optional. Start position for the substring of **_expression_** to be searched and returned. If omitted, 1 is assumed.|
|**_count_**|Optional. Number of substring substitutions to perform. If omitted, the default value is -1, which means make all possible substitutions.|
|**_compare_**|Optional. Numeric value indicating the kind of comparison to use when evaluating substrings. See Settings section for values.|

Expand Down
29 changes: 14 additions & 15 deletions Language/Reference/User-Interface-Help/rnd-function.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,30 @@ ms.date: 06/08/2017



Returns a **Single** containing a random number.
Returns a **Single** containing a pseudo-random number.

## Syntax

**Rnd** [ **(**_number_**)** ]
The optional _number_[argument](../../Glossary/vbe-glossary.md#argument) is a[Single](../../Glossary/vbe-glossary.md#single-data-type) or any valid[numeric expression](../../Glossary/vbe-glossary.md#numeric-expression).
**Return Values**
**Rnd** [ **(**_Number_**)** ]
The optional _Number_ [argument](../../Glossary/vbe-glossary.md#argument) is a [Single](../../Glossary/vbe-glossary.md#single-data-type) or any valid [numeric expression](../../Glossary/vbe-glossary.md#numeric-expression).

**Return Values**

|**If _number_ is**|**Rnd generates**|
|**If _Number_ is**|**Rnd generates**|
|:-----|:-----|
|Less than zero|The same number every time, using _number_ as the[seed](../../Glossary/vbe-glossary.md#seed).|
|Greater than zero|The next random number in the sequence.|
|Less than zero|The same number every time, using _Number_ as the [seed](../../Glossary/vbe-glossary.md#seed).|
|Greater than zero|The next number in the pseudo-random sequence.|
|Equal to zero|The most recently generated number.|
|Not supplied|The next random number in the sequence.|
|Not supplied|The next number in the pseudo-random sequence.|

## Remarks

The **Rnd** function returns a value less than 1 but greater than or equal to zero.
The value of _number_ determines how **Rnd** generates a random number:
The value of _Number_ determines how **Rnd** generates a pseudo-random number:
For any given initial seed, the same number sequence is generated because each successive call to the **Rnd** function uses the previous number as a seed for the next number in the sequence.
Before calling **Rnd,** use the **Randomize** statement without an argument to initialize the random-number generator with a seed based on the system timer.
To produce random integers in a given range, use this formula:

Before calling **Rnd,** use the **Randomize** statement without an argument to initialize the random-number generator with a seed based on the system timer.

To produce random integers in a given range, use this formula:

```vb
Int((upperbound - lowerbound + 1) * Rnd + lowerbound)
Expand All @@ -46,16 +45,16 @@ Int((upperbound - lowerbound + 1) * Rnd + lowerbound)

Here, _upperbound_ is the highest number in the range, and _lowerbound_ is the lowest number in the range.

**Note** To repeat sequences of random numbers, call **Rnd** with a negative argument immediately before using **Randomize** with a numeric argument. Using **Randomize** with the same value for _number_ does not repeat the previous sequence.
**Note** To repeat sequences of random numbers, call **Rnd** with a negative argument immediately before using **Randomize** with a numeric argument. Using **Randomize** with the same value for _Number_ does not repeat the previous sequence.


## Example

This example uses the **Rnd** function to generate a random integer value from 1 to 6.
This example uses the **Rnd** function to generate a random integer value from 1 to 6.


```vb
Dim MyValue
Dim MyValue As Integer
MyValue = Int((6 * Rnd) + 1) ' Generate random value between 1 and 6.


Expand Down
10 changes: 5 additions & 5 deletions Language/Reference/User-Interface-Help/set-statement.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ ms.date: 06/08/2017

# Set Statement

Assigns an object reference to a [variable](../../Glossary/vbe-glossary.md#variable) or[property](../../Glossary/vbe-glossary.md#property).
Assigns an object reference to a [variable](../../Glossary/vbe-glossary.md#variable) or [property](../../Glossary/vbe-glossary.md#property).

## Syntax

Expand All @@ -23,15 +23,15 @@ The **Set** statement syntax has these parts:
|**Part**|**Description**|
|:-----|:-----|
| _objectvar_|Required. Name of the variable or property; follows standard variable naming conventions.|
|**New**|Optional. **New** is usually used during declaration to enable implicit object creation. When **New** is used with **Set**, it creates a new instance of the[class](../../Glossary/vbe-glossary.md#class). If _objectvar_ contained a reference to an object, that reference is released when the new one is assigned. The **New**[keyword](../../Glossary/vbe-glossary.md#keyword) can't be used to create new instances of any intrinsic[data type](../../Glossary/vbe-glossary.md#data-type) and can't be used to create dependent objects.|
| _objectexpression_|Required. [Expression](../../Glossary/vbe-glossary.md#expression) consisting of the name of an object, another declared variable of the same[object type](../../Glossary/vbe-glossary.md#object-type), or a function or [method](../../Glossary/vbe-glossary.md#method) that returns an object of the same object type.|
|**New**|Optional. **New** is usually used during declaration to enable implicit object creation. When **New** is used with **Set**, it creates a new instance of the [class](../../Glossary/vbe-glossary.md#class). If _objectvar_ contained a reference to an object, that reference is released when the new one is assigned. The **New** [keyword](../../Glossary/vbe-glossary.md#keyword) can't be used to create new instances of any intrinsic [data type](../../Glossary/vbe-glossary.md#data-type) and can't be used to create dependent objects.|
| _objectexpression_|Required. [Expression](../../Glossary/vbe-glossary.md#expression) consisting of the name of an object, another declared variable of the same [object type](../../Glossary/vbe-glossary.md#object-type), or a function or [method](../../Glossary/vbe-glossary.md#method) that returns an object of the same object type.|
|**Nothing**|Optional. Discontinues association of _objectvar_ with any specific object. Assigning **Nothing** to _objectvar_ releases all the system and memory resources associated with the previously referenced object when no other variable refers to it.|

## Remarks

To be valid, _objectvar_ must be an object type consistent with the object being assigned to it.
The **Dim**, **Private**, **Public**, **ReDim**, and **Static** statements only declare a variable that refers to an object. No actual object is referred to until you use the **Set** statement to assign a specific object.
The following example illustrates how **Dim** is used to declare an[array](../../Glossary/vbe-glossary.md#array) with the type `Form1`. No instance of `Form1` actually exists. **Set** then assigns references to new instances of `Form1` to the . No instance of `Form1` actually exists. **Set** then assigns references to new instances of `Form1` to the `myChildForms` variable. Such code might be used to create child forms in an MDI application.
The following example illustrates how **Dim** is used to declare an [array](../../Glossary/vbe-glossary.md#array) with the type `Form1`. No instance of `Form1` actually exists. **Set** then assigns references to new instances of `Form1` to the . No instance of `Form1` actually exists. **Set** then assigns references to new instances of `Form1` to the `myChildForms` variable. Such code might be used to create child forms in an MDI application.



Expand All @@ -44,7 +44,7 @@ Set myChildForms(4) = New Form1

```

Generally, when you use **Set** to assign an object reference to a variable, no copy of the object is created for that variable. Instead, a reference to the object is created. More than one[object variable](../../Glossary/vbe-glossary.md#object-variable) can refer to the same object. Because such variables are references to the object rather than copies of the object, any change in the object is reflected in all variables that refer to it. However, when you use the **New** keyword in the **Set** statement, you are actually creating an instance of the object.
Generally, when you use **Set** to assign an object reference to a variable, no copy of the object is created for that variable. Instead, a reference to the object is created. More than one [object variable](../../Glossary/vbe-glossary.md#object-variable) can refer to the same object. Because such variables are references to the object rather than copies of the object, any change in the object is reflected in all variables that refer to it. However, when you use the **New** keyword in the **Set** statement, you are actually creating an instance of the object.

## Example

Expand Down
4 changes: 2 additions & 2 deletions api/Access.AccessObject.IsLoaded.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ If Not CurrentProject.AllForms(cFormUsage).IsLoaded Then
End If
```

## About the contributors
<a name="AboutContributors"> </a>
### About the contributors

Wrox Press is driven by the Programmer to Programmer philosophy. Wrox books are written by programmers for programmers, and the Wrox brand means authoritative solutions to real-world programming problems.

## See also

[AccessObject Object](Access.AccessObject.md)


5 changes: 2 additions & 3 deletions api/Access.AllForms.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,18 +76,17 @@ End If
|[Item](Access.AllForms.Item.md)|
|[Parent](Access.AllForms.Parent.md)|

## About the Contributors
<a name="AboutContributors"> </a>
### About the contributors

Wrox Press is driven by the Programmer to Programmer philosophy. Wrox books are written by programmers for programmers, and the Wrox brand means authoritative solutions to real-world programming problems.


## See also
<a name="AboutContributors"> </a>





[Access Object Model Reference](overview/Access/object-model.md)
[AllForms Object Members](overview/Access.md)

4 changes: 2 additions & 2 deletions api/Access.Application.DCount.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,7 @@ The following examples show how to use various types of criteria with the **DCo
```


## About the Contributors
<a name="AboutContributors"> </a>
### About the contributors

UtterAccess is the premier Microsoft Access wiki and help forum. Click here to join.

Expand All @@ -167,3 +166,4 @@ UtterAccess is the premier Microsoft Access wiki and help forum. Click here to j

[Application Object](Access.Application.md)


4 changes: 2 additions & 2 deletions api/Access.Application.DFirst.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,7 @@ The following examples show how to use various types of criteria with the **DFi
```


## About the Contributors
<a name="AboutContributors"> </a>
### About the contributors

UtterAccess is the premier Microsoft Access wiki and help forum. Click here to join.

Expand All @@ -114,3 +113,4 @@ UtterAccess is the premier Microsoft Access wiki and help forum. Click here to j

[Application Object](Access.Application.md)


4 changes: 2 additions & 2 deletions api/Access.Application.DLast.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,7 @@ The following examples show how to use various types of criteria with the **DLa
```


## About the Contributors
<a name="AboutContributors"> </a>
### About the contributors

UtterAccess is the premier Microsoft Access wiki and help forum. Click here to join.

Expand All @@ -114,3 +113,4 @@ UtterAccess is the premier Microsoft Access wiki and help forum. Click here to j

[Application Object](Access.Application.md)


4 changes: 2 additions & 2 deletions api/Access.Application.DLookup.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,7 @@ The following examples show how to use various types of criteria with the **DLo
```


## About the Contributors
<a name="AboutContributors"> </a>
### About the contributors

UtterAccess is the premier Microsoft Access wiki and help forum. Click here to join.

Expand All @@ -187,3 +186,4 @@ UtterAccess is the premier Microsoft Access wiki and help forum. Click here to j

[Application Object](Access.Application.md)


4 changes: 2 additions & 2 deletions api/Access.Application.DMax.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,7 @@ The following examples show how to use various types of criteria with the **DMa
```


## About the Contributors
<a name="AboutContributors"> </a>
### About the contributors

UtterAccess is the premier Microsoft Access wiki and help forum. Click here to join.

Expand All @@ -161,3 +160,4 @@ UtterAccess is the premier Microsoft Access wiki and help forum. Click here to j

[Application Object](Access.Application.md)


4 changes: 2 additions & 2 deletions api/Access.Application.DMin.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,7 @@ The following examples show how to use various types of criteria with the **DMi
```


## About the Contributors
<a name="AboutContributors"> </a>
### About the contributors

UtterAccess is the premier Microsoft Access wiki and help forum. Click here to join.

Expand All @@ -149,3 +148,4 @@ UtterAccess is the premier Microsoft Access wiki and help forum. Click here to j

[Application Object](Access.Application.md)


4 changes: 2 additions & 2 deletions api/Access.Application.DStDev.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,7 @@ The following examples show how to use various types of criteria with the **DSt
```


## About the Contributors
<a name="AboutContributors"> </a>
### About the contributors

UtterAccess is the premier Microsoft Access wiki and help forum. Click here to join.

Expand All @@ -173,3 +172,4 @@ UtterAccess is the premier Microsoft Access wiki and help forum. Click here to j

[Application Object](Access.Application.md)


4 changes: 2 additions & 2 deletions api/Access.Application.DStDevP.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,7 @@ The following examples show how to use various types of criteria with the **DSt
```


## About the Contributors
<a name="AboutContributors"> </a>
### About the contributors

UtterAccess is the premier Microsoft Access wiki and help forum. Click here to join.

Expand All @@ -157,3 +156,4 @@ UtterAccess is the premier Microsoft Access wiki and help forum. Click here to j

[Application Object](Access.Application.md)


4 changes: 2 additions & 2 deletions api/Access.Application.DSum.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,7 @@ The following examples show how to use various types of criteria with the **DSu
```


## About the Contributors
<a name="AboutContributors"> </a>
### About the contributors

UtterAccess is the premier Microsoft Access wiki and help forum. Click here to join.

Expand All @@ -143,3 +142,4 @@ UtterAccess is the premier Microsoft Access wiki and help forum. Click here to j

[Application Object](Access.Application.md)


4 changes: 2 additions & 2 deletions api/Access.Application.DVar.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,7 @@ The following examples show how to use various types of criteria with the **DVa
```


## About the Contributors
<a name="AboutContributors"> </a>
### About the contributors

UtterAccess is the premier Microsoft Access wiki and help forum. Click here to join.

Expand All @@ -160,3 +159,4 @@ UtterAccess is the premier Microsoft Access wiki and help forum. Click here to j

[Application Object](Access.Application.md)


4 changes: 2 additions & 2 deletions api/Access.Application.DVarP.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,7 @@ The following examples show how to use various types of criteria with the **DVa
```


## About the Contributors
<a name="AboutContributors"> </a>
### About the contributors

UtterAccess is the premier Microsoft Access wiki and help forum. Click here to join.

Expand All @@ -134,3 +133,4 @@ UtterAccess is the premier Microsoft Access wiki and help forum. Click here to j

[Application Object](Access.Application.md)


4 changes: 2 additions & 2 deletions api/Access.Application.Nz.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,7 @@ End Sub
```


## About the Contributors
<a name="AboutContributors"> </a>
### About the contributors

UtterAccess is the premier Microsoft Access wiki and help forum. Click here to join.

Expand All @@ -131,3 +130,4 @@ UtterAccess is the premier Microsoft Access wiki and help forum. Click here to j

[Application Object](Access.Application.md)


Loading