Setting parameters of built-in dialog in Word?

M

Microsoft News

Hello,

I have the following problem: I want to manually display a built-in dialog
box from a COM-addin in Word [2003] and get/set some of the dialog's
parameters. From MSDN the only information that I could find was this:

Sub test()
Dim dlg As Dialog
Set dlg = Dialogs(wdDialogFileSaveAs)
dlg.Name = "whatever.doc"
dlg.Show
End Sub

This seems to work (also from a Word macro). But I need to do this from C++
and I cannot figure out how to get to the Name (and other) properties of a
built-in dialog. What I am doing:

CComQIPtr<Word::Dialogs> ptrDialogs = m_ptrApplication->Dialogs;
CComQIPtr<Word::Dialog> ptrSaveAsDlg = ptrDialogs->Item(wdDialogFileSaveAs);
then I'm stuck, because all the dialogs are of the same type and none has a
Name property. Apparently these are the properties supported by the SaveAs
dialog:

Name, Format, LockAnnot, Password, AddToMru, WritePassword,
RecommendReadOnly, EmbedFonts, NativePictureFormat, FormsData,
SaveAsAOCELetter, WriteVersion, VersionDesc, InsertLineBreaks,
AllowSubstitutions, LineEnding, AddBiDiMarks

But where are they stored? Anyone knows this? Any help would be greately
appreciated.

Thanks and best regards,
Levente
 
C

Cindy M -WordMVP-

Hi Levente,

Word's built-in dialog box interfaces date back to the "good old" WordBasic
days. Therefore, the interface isn't in the object model library, but another
one, that the VB/COM-interface can deal with directly.

When automating Word from another language, that handles data-typing, etc.
more strictly, such as C# or C++, you must use "late-binding" (Invoke). Read
the section on "Late binding in Word" in this article for C# to get a general
idea:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odc_vsto2003_
ta/html/OffCSharp.asp
I have the following problem: I want to manually display a built-in dialog
box from a COM-addin in Word [2003] and get/set some of the dialog's
parameters. From MSDN the only information that I could find was this:

Sub test()
Dim dlg As Dialog
Set dlg = Dialogs(wdDialogFileSaveAs)
dlg.Name = "whatever.doc"
dlg.Show
End Sub

This seems to work (also from a Word macro). But I need to do this from C++
and I cannot figure out how to get to the Name (and other) properties of a
built-in dialog. What I am doing:

CComQIPtr<Word::Dialogs> ptrDialogs = m_ptrApplication->Dialogs;
CComQIPtr<Word::Dialog> ptrSaveAsDlg = ptrDialogs->Item(wdDialogFileSaveAs);
then I'm stuck, because all the dialogs are of the same type and none has a
Name property. Apparently these are the properties supported by the SaveAs
dialog:

Name, Format, LockAnnot, Password, AddToMru, WritePassword,
RecommendReadOnly, EmbedFonts, NativePictureFormat, FormsData,
SaveAsAOCELetter, WriteVersion, VersionDesc, InsertLineBreaks,
AllowSubstitutions, LineEnding, AddBiDiMarks

But where are they stored? Anyone knows this? Any help would be greately
appreciated.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top