Results 1 to 5 of 5
  1. #1
    New Lounger
    Join Date
    Aug 2002
    Location
    Geelong, Victoria, Australia
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Hiding a built-in dialog (wordbasic/VBA)

    I need to obtain the class property when inserting an object in Word8/9. However, I don't want to display the dialog but cannot get sendkeys to work with it.

    What I would like to do is send a value to the OK command button so that user interaction is not required and to avoid the timing problems of sendkeys. I would be grateful for any help.

    Set test = Dialogs(wdDialogInsertObject)
    With test
    .FileName = "d:word9doc.doc"
    .tab = 1
    .Display
    DocClass = .Class
    End With

    MsgBox (DocClass)

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Hiding a built-in dialog (wordbasic/VBA)

    Use .Execute instead of .Display

  3. #3
    New Lounger
    Join Date
    Aug 2002
    Location
    Geelong, Victoria, Australia
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Hiding a built-in dialog (wordbasic/VBA)

    Thanks Hans.

    Sorry but I forgot to say that I want to obtain the file class without actually inserting the object in the file. This is why I am using .Display instead of .Execute. (Unfortunately, .Hide doesn't work.)

    What I want to do is get the class of the Word file that I am opening to see if it is a Word6/7 file. I want to do this to ensure that I don't corrupt WordBasic macros stored in the Word7 template attached to the file.

    The only way that I can find to do this (in both WordBasic and VBA) is to obtain the .Class property using the built-in dialog for inserting an object but I can't either hide the dialog from the user or automatically complete it.

    Any more suggestions would be appreciated.

  4. #4
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: Hiding a built-in dialog (wordbasic/VBA)

    Not an ideal solution, but:

    .Display 1

    should display the dialog onscreen for only one-thousandth of a second - the user will see it flash onscreen but then disappear.

    Gary

  5. #5
    New Lounger
    Join Date
    Aug 2002
    Location
    Geelong, Victoria, Australia
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Hiding a built-in dialog (wordbasic/VBA)

    Thanks Gary.

    It would be nice to hide the dialog but I guess that's the best I can hope for.

    Cheers,

    Peter.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •