Skip to content

Commit d8056c0

Browse files
author
Linda Caputo
committed
Edit pass on Statements M-P
1 parent 30773c1 commit d8056c0

24 files changed

+393
-318
lines changed

Language/Concepts/Getting-Started/deftype-statements.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,21 +59,33 @@ The statement name determines the data type.
5959

6060
<br/>
6161

62+
For example, in the following program fragment, `Message` is a string variable:
63+
64+
```vb
65+
DefStr A-Q
66+
. . .
67+
Message = "Out of stack space."
68+
```
69+
6270
A **Def**_type_ statement affects only the [module](../../Glossary/vbe-glossary.md#module) where it is used. For example, a **DefInt** statement in one module affects only the default data type of variables, arguments passed to procedures, and the return type for **Function** and **Property Get** procedures declared in that module; the default data type of variables, arguments, and return types in other modules is unaffected. If not explicitly declared with a **Def**_type_ statement, the default data type for all variables, all arguments, all **Function** procedures, and all **Property Get** procedures is **Variant**.
6371

6472
When you specify a letter range, it usually defines the data type for variables that begin with letters in the [first 128 characters of the character set](../../reference/user-interface-help/character-set-0127.md). However, when you specify the letter range A-Z, you set the default to the specified data type for all variables, including variables that begin with international characters from the [extended part of the character set (128-255)](../../reference/user-interface-help/character-set-128255.md).
6573

6674
After the range A-Z has been specified, you can't further redefine any subranges of variables by using **Def**_type_ statements. After a range has been specified, if you include a previously defined letter in another **Def**_type_ statement, an error occurs. However, you can explicitly specify the data type of any variable, defined or not, by using a **[Dim](../../reference/user-interface-help/dim-statement.md)** statement with an **As**_type_ clause.
6775

68-
<!--[MISSING EXAMPLE CODE] For example, you can use the following code at the module level to define a variable as a **Double** even though the default data type is **Integer**: -->
76+
For example, you can use the following code at the module level to define a variable as a **Double** even though the default data type is **Integer**:
77+
78+
```vb
79+
DefInt A-Z
80+
Dim TaxRate As Double
81+
```
6982

7083
**Def**_type_ statements don't affect elements of [user-defined types](../../Glossary/vbe-glossary.md#user-defined-type) because the elements must be explicitly declared.
7184

72-
<!--[MISSING EXAMPLE CODE and SUBJECT] For example, in the following program fragment, is a string variable:-->
7385

7486
<!--[MISSING EXAMPLE CODE] ## Example
7587
76-
This example shows various uses of the **Def**_type_ statements to set default data types of variables and function procedures whose names start with specified characters. The default data type can be overridden only by explicit assignment by using the **Dim** statement. **Def**_type_ statements can only be used at the module level (that is, not within procedures).-->
88+
This example shows various uses of the **Def**_type_ statements to set default data types of variables and function procedures whose names start with specified characters. The default data type can be overridden only by explicit assignment by using the **Dim** statement. **Def**_type_ statements can only be used at the module level (that is, not within procedures).-->
7789

7890

7991
## See also

Language/Reference/User-Interface-Help/friend-keyword.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Friend keyword
2+
title: Friend keyword (VBA)
33
keywords: vblr6.chm1103683
44
f1_keywords:
55
- vblr6.chm1103683

Language/Reference/User-Interface-Help/lset-statement.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,4 @@ Lset MyString = "<-Left" ' MyString contains "<-Left ".
5353
## See also
5454

5555
- [Data types](data-type-summary.md)
56-
- [Statements](../statements.md)
56+
- [Statements](../statements.md)

Language/Reference/User-Interface-Help/me-keyword.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Me keyword
2+
title: Me keyword (VBA)
33
keywords: vblr6.chm1008868
44
f1_keywords:
55
- vblr6.chm1008868

Language/Reference/User-Interface-Help/mid-statement.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
2-
title: Mid statement
2+
title: Mid statement (VBA)
33
keywords: vblr6.chm1011353
44
f1_keywords:
55
- vblr6.chm1011353
66
ms.prod: office
77
ms.assetid: a9923853-55d5-5b50-d422-57cba84d9f47
8-
ms.date: 06/08/2017
8+
ms.date: 12/03/2018
99
---
1010

1111

@@ -15,9 +15,9 @@ Replaces a specified number of characters in a **Variant** (**String**) [variabl
1515

1616
## Syntax
1717

18-
**Mid** ( _stringvar_, _start_ [, _length_ ]) **=**_string_
18+
**Mid**( _stringvar_, _start_, [ _length_ ] ) **=** _string_
1919

20-
The **Mid** statement syntax has these parts.
20+
The **Mid** statement syntax has these parts:
2121

2222
|Part|Description|
2323
|:-----|:-----|
@@ -28,10 +28,10 @@ The **Mid** statement syntax has these parts.
2828

2929
## Remarks
3030

31-
The number of characters replaced is always less than or equal to the number of characters in _stringvar_.
31+
The number of characters replaced is always less than or equal to the number of characters in _stringvar_.
3232

3333
> [!NOTE]
34-
> Use the **MidB** statement with byte data contained in a string. In the **MidB** statement, _start_ specifies the byte position within _stringvar_ where replacement begins and _length_ specifies the numbers of bytes to replace.
34+
> Use the **MidB** statement with byte data contained in a string. In the **MidB** statement, _start_ specifies the byte position within _stringvar_ where replacement begins, and _length_ specifies the numbers of bytes to replace.
3535
3636

3737
## Example
@@ -49,4 +49,7 @@ Mid(MyString, 5, 3) = "duck" ' MyString = "The duc jumpe".
4949

5050
```
5151

52+
## See also
5253

54+
- [Data types](data-type-summary.md)
55+
- [Statements](../statements.md)
Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,35 @@
11
---
2-
title: MkDir Statement
2+
title: MkDir statement (VBA)
33
keywords: vblr6.chm1008975
44
f1_keywords:
55
- vblr6.chm1008975
66
ms.prod: office
77
ms.assetid: b79fdad3-a1c2-7af3-c679-09d35d4b0d87
8-
ms.date: 06/08/2017
8+
ms.date: 12/03/2018
99
---
1010

1111

12-
# MkDir Statement
12+
# MkDir statement
1313

1414
Creates a new directory or folder.
1515

1616
## Syntax
1717

18-
**MkDir**_path_
18+
**MkDir** _path_
1919

20-
The required _path_ [argument](../../Glossary/vbe-glossary.md#argument) is a [string expression](../../Glossary/vbe-glossary.md#string-expression) that identifies the directory or folder to be created. The _path_ may include the drive. If no drive is specified, **MkDir** creates the new directory or folder on the current drive.
20+
The required _path_ [argument](../../Glossary/vbe-glossary.md#argument) is a [string expression](../../Glossary/vbe-glossary.md#string-expression) that identifies the directory or folder to be created. The _path_ may include the drive. If no drive is specified, **MkDir** creates the new directory or folder on the current drive.
2121

2222
## Example
2323

24-
This example uses the **MkDir** statement to create a directory or folder. If the drive is not specified, the new directory or folder is created on the current drive.
24+
This example uses the **MkDir** statement to create a directory or folder. If the drive is not specified, the new directory or folder is created on the current drive.
2525

2626

2727
```vb
2828
MkDir "MYDIR" ' Make new directory or folder.
2929

3030
```
3131

32+
## See also
3233

34+
- [Data types](data-type-summary.md)
35+
- [Statements](../statements.md)
Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,38 @@
11
---
2-
title: Name Statement
2+
title: Name statement (VBA)
33
keywords: vblr6.chm1008979
44
f1_keywords:
55
- vblr6.chm1008979
66
ms.prod: office
77
ms.assetid: c248e962-1265-b871-3ef7-36effb070d2b
8-
ms.date: 06/08/2017
8+
ms.date: 12/03/2018
99
---
1010

1111

12-
# Name Statement
12+
# Name statement
1313

1414
Renames a disk file, directory, or folder.
1515

1616
## Syntax
1717

18-
**Name**_oldpathname_**As**_newpathname_
19-
20-
The **Name** statement syntax has these parts:
18+
**Name** _oldpathname_ **As** _newpathname_
2119

20+
The **Name** statement syntax has these parts:
2221

2322
|Part|Description|
2423
|:-----|:-----|
25-
| _oldpathname_|Required. [String expression](../../Glossary/vbe-glossary.md#string-expression) that specifies the existing file name and location may include directory or folder, and drive.|
26-
| _newpathname_|Required. String expression that specifies the new file name and locationmay include directory or folder, and drive. The file name specified by _newpathname_ can't already exist.|
24+
| _oldpathname_|Required. [String expression](../../Glossary/vbe-glossary.md#string-expression) that specifies the existing file name and location; may include directory or folder, and drive.|
25+
| _newpathname_|Required. String expression that specifies the new file name and location; may include directory or folder, and drive. The file name specified by _newpathname_ can't already exist.|
2726

2827
## Remarks
2928

30-
The Name statement renames a file and moves it to a different directory or folder, if necessary. Name can move a file across drives, but it can only rename an existing directory or folder when both newpathname and oldpathname are located on the same drive. Name cannot create a new file, directory, or folder.
31-
Using **Name** on an open file produces an error. You must close an open file before renaming it. **Name** [arguments](../../Glossary/vbe-glossary.md#argument) cannot include multiple-character (**\***) and single-character (**?**) wildcards.
29+
The **Name** statement renames a file and moves it to a different directory or folder, if necessary. **Name** can move a file across drives, but it can only rename an existing directory or folder when both _newpathname_ and _oldpathname_ are located on the same drive. **Name** cannot create a new file, directory, or folder.
30+
31+
Using **Name** on an open file produces an error. You must close an open file before renaming it. **Name** [arguments](../../Glossary/vbe-glossary.md#argument) cannot include multiple-character (**\***) and single-character (**?**) wildcards.
3232

3333
## Example
3434

35-
This example uses the **Name** statement to rename a file. For purposes of this example, assume that the directories or folders that are specified already exist. On the Macintosh, "HD:" is the default drive name and portions of the pathname are separated by colons instead of backslashes.
35+
This example uses the **Name** statement to rename a file. For purposes of this example, assume that the directories or folders that are specified already exist. On the Macintosh, "HD:" is the default drive name, and portions of the pathname are separated by colons instead of backslashes.
3636

3737

3838
```vb
@@ -45,4 +45,7 @@ Name OldName As NewName ' Move and rename file.
4545

4646
```
4747

48+
## See also
4849

50+
- [Data types](data-type-summary.md)
51+
- [Statements](../statements.md)

Language/Reference/User-Interface-Help/nothing-keyword.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Nothing keyword
2+
title: Nothing keyword (VBA)
33
keywords: vblr6.chm1011405
44
f1_keywords:
55
- vblr6.chm1011405

0 commit comments

Comments
 (0)