WD: WordBasic Error 152 with DlgFilePreview Statement |
Q110414
If 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:
The WordBasic DlgFilePreview statement is used within a Word 6.0 for Windows dialog function to preview the document specified by Filename$.WordBasic Error 152
This command is not available because no document is open.
DlgFilePreview [Identifier[$]] [, Filename$]
Microsoft 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 professionals 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 a Microsoft Certified Partner or the Microsoft fee-based consulting line at (800) 936-5200. For more information about Microsoft Certified Partners, please see the following page on the World Wide Web:
http://www.microsoft.com/partner/referral/For more information about the support options available from Microsoft, please see the following page on the World Wide Web:
http://support.microsoft.com/directory/overview.aspThe 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 Function
Note 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 152 not available
Keywords : kberrmsg kbmacro kbprg kbdtacode kbmacroexample winword macword word6 word7 word95
Issue type : kbprb
Technology : kbWordSearch kbWordWSearch kbWordMSearch
|
Last Reviewed: December 29, 2000 © 2001 Microsoft Corporation. All rights reserved. Terms of Use. |