# CreatePrompt
{: .no_toc }

Returns or sets whether the Open dialog asks permission before it accepts the name of a file that does not exist.

Syntax: *object*.**CreatePrompt** [ = *boolean* ]

*object*
: *required* An object expression that evaluates to a **cDialog**.

*boolean*
: A **Boolean**. **True** sets `OFN_CREATEPROMPT`. The default is **False**.

## Remarks

Only [**ShowOpen**](/tB/Packages/Contributed/TBMANLIB_Dialog/cDialog/ShowOpen.md) uses the property. [**ShowSave**](/tB/Packages/Contributed/TBMANLIB_Dialog/cDialog/ShowSave.md) never sets `OFN_CREATEPROMPT`, and [**ShowBrowseForFolder**](/tB/Packages/Contributed/TBMANLIB_Dialog/cDialog/ShowBrowseForFolder.md) ignores the property.

When the user types the name of a file that does not exist, such as `nosuch.txt`, the box *This file doesn't exist. Create the file?* appears, with the buttons *Yes* and *No*. *Yes* closes the dialog and returns the path. *No* leaves the dialog open. This happens whether [**FileMustExist**](/tB/Packages/Contributed/TBMANLIB_Dialog/cDialog/FileMustExist.md) is **True** or **False**, so the question takes the place of the *File not found* box that **FileMustExist** shows.

The file is not created: neither the dialog nor the class creates it, and the program has to do so.

## Example

```tb check_build check_run
Dim dlg As New cDialog
Debug.Print dlg.CreatePrompt   ' False

dlg.CreatePrompt = True
Debug.Print dlg.CreatePrompt   ' True
```

This example lets the user name a new file in the Open dialog and creates it when the user agrees.

```tb check_build
Dim dlg As New cDialog
Dim path As String

dlg.CreatePrompt = True
path = dlg.ShowOpen()
If Len(path) > 0 Then
    If Len(Dir$(path)) = 0 Then
        Open path For Output As #1
        Close #1
    End If
End If
```

## See Also

- [FileMustExist](/tB/Packages/Contributed/TBMANLIB_Dialog/cDialog/FileMustExist.md) property -- lets only names of existing files through
- [ShowOpen](/tB/Packages/Contributed/TBMANLIB_Dialog/cDialog/ShowOpen.md) method -- shows the Open dialog
- [cDialog](/tB/Packages/Contributed/TBMANLIB_Dialog/cDialog/index.md) class -- overview
