WD: WordBasic Error 152 with DlgFilePreview StatementLast reviewed: November 17, 1997Article ID: Q110414 |
The information in this article applies to:
SYMPTOMSIf you specify a document file name to preview with the DlgFilePreview statement and no document windows are open, the DlgFilePreview statement generates the following error:
WordBasic Error 152 This command is not available because no document is open.The WordBasic DlgFilePreview statement is used within a Word 6.0 for Windows dialog function to preview the document specified by Filename$.
Syntax for DlgFilePreviewDlgFilePreview [Identifier[$]] [, Filename$]
MORE INFORMATIONMicrosoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact the Microsoft fee-based consulting line at (800) 936-5200. For more information about the support options available from Microsoft, please see the following page on the World Wide Web:
http://www.microsoft.com/supportnet/refguide/The following sample macro checks the number of open windows (CountWindows) prior to displaying the dialog box. If no document windows are open, the macro opens a new document window with ScreenUpdating turned off. When the dialog box is closed, the new document window is closed without saving changes.
Sub MAIN Begin Dialog UserDialog 354, 258, "Preview", .dlgTest PushButton 255, 10, 88, 21, "Close", .close Text 15, 8, 151, 25, "File Preview Example:", .Text1 FilePreview 15, 58, 219, 183, .fileprev End Dialog Dim dlg As UserDialog ScreenUpdating 0 If CountWindows() = 0 Then FileNewDefault ThisWindow$ = WindowName$() DocMinimize End If x = Dialog(dlg) If ThisWindow$ <> "" Then Activate ThisWindow$ FileClose 2 End If End Sub Function dlgTest(identifier$, action, suppvalue) Select Case action Case 1 DlgFilePreview "fileprev", "C:\WINWORD\TEST.DOC" Case Else End Select End FunctionNote to Macintosh users: Use a Macintosh path in the DlgFilePreview command line, for example:
DlgFilePreview "fileprev", "Macintosh HD:Desktop Folder:Test Document"For information about using a dialog function, see the "Creating Dynamic Dialog Boxes" topic in the Word 6.0 Online Help file.
|
Additional query words: DlgFilePreview dialog dynamic function boxes error
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |