Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / September 2005

Tip: Looking for answers? Try searching our database.

Built in Word dialog problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Haydn Robinson - 19 Sep 2005 15:19 GMT
I'm trying to use on of Word's built in dialogs, namely the table auto-format
dialog.  Reading up on MSDN, this should work:

Word.Dialog dlg =
Application.Dialogs[Word.WdWordDialog.wdDialogTableAutoFormat];

However, doing this I get the following error:

"Microsoft Word: This method or property is not available because some or
all of the current selection is not in a table."

What am I doing wrong?
Haydn Robinson - 19 Sep 2005 15:38 GMT
Oh yes, forgot to mention, using WinXP SP2 and Word 2003 SP1.

> I'm trying to use on of Word's built in dialogs, namely the table auto-format
> dialog.  Reading up on MSDN, this should work:
[quoted text clipped - 8 lines]
>
> What am I doing wrong?
Jay Freedman - 19 Sep 2005 15:54 GMT
> Oh yes, forgot to mention, using WinXP SP2 and Word 2003 SP1.
>
[quoted text clipped - 10 lines]
>>
>> What am I doing wrong?

When you execute that line of code, is the selection (insertion point)
inside a table in the active document? That condition must be true in order
to display that dialog from code. (In the UI you can use the Table > Table
AutoFormat command to display the dialog when not in a table, but clicking
OK immediately runs the Insert Table dialog. This is a special case in the
UI and isn't available to code.)

You can test this assumption by calling
Selection.Information(wdWithInTable) -- however you have to mangle that to
get the right syntax -- it returns True if the Selection is entirely within
a table.

Signature

Regards,
Jay Freedman
Microsoft Word MVP          FAQ: http://word.mvps.org

Haydn Robinson - 19 Sep 2005 16:05 GMT
No the selection isn't in a table.  What I have is a dialog my end that
allows someone to setup a table, with the added option of picking a
pre-defined Word table style.  What I wanted was a button on my dialog that
would bring up the Word auto format dialog, so the user can see what style
they're getting.  Looks like I'll have to fall back to a dropdown with just
the names of the styles in.

Thanks for that.

Haydn

> > Oh yes, forgot to mention, using WinXP SP2 and Word 2003 SP1.
> >
[quoted text clipped - 22 lines]
> get the right syntax -- it returns True if the Selection is entirely within
> a table.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.