Results 1 to 6 of 6

Thread: How To Dismiss a Dialog Box Displayed by an Office Application with Visual Basic?

  1. #1
    Join Date
    Apr 2009
    Posts
    515

    How To Dismiss a Dialog Box Displayed by an Office Application with Visual Basic?

    Hi friends,
    I am facing some difficulties while dismissing the dialog box that is displayed by an applications of Microsoft Office. I am trying to dismiss that by using the Visual Basic. When I am automating an Office application in VB it displays a dialog box. The dialog makes it appear that the Visual Basic stops responding because Visual Basic is expected to dismiss the dialog. So help me to fix this issue.!! Please tell me how to dismiss a Dialog Box displayed by an Office Application with Visual Basic.??

  2. #2
    Join Date
    May 2008
    Posts
    376

    Re: How To Dismiss a Dialog Box Displayed by an Office Application with Visual Basic?

    Sometimes, you may want to automate an Office application but that does not require any user interaction with it. In this case, if the Office application displays a dialog box appears that the application stops responding until a user can dismiss the dialog. However, you may not have any user sitting at the computer to dismiss the dialog. Office applications were not designed to run unattended. Therefore, an application that automates Office can sometimes be a dialog box that has shown the Office application. Thanks to the usual tests of the application, you can usually determine which dialog boxes appear and write code to avoid them.

  3. #3
    Join Date
    Aug 2006
    Posts
    222

    Re: How To Dismiss a Dialog Box Displayed by an Office Application with Visual Basic?

    You can use the described strategy to prevent displaying any dialog boxes to automate an Office application. Determine if the property or method you are using (which is causing the dialog box) has optional arguments that can happen. Sometimes, you can avoid a dialog box passing all arguments to the property or method. For example, if you use the Open method to open an Excel workbook and that book is protected by a password, Excel displays a dialog box that prompts the user for the password, if not provided the password argument when calling the Open method. To avoid the dialog box, provide a value for the Password argument when calling the Open method. Similarly, when using the Close method to close a document, it is often helpful to specify the SaveChanges argument to avoid a dialog appears asking the user to save the changes.
    Just a reply to say thank you for these links and posts I have a lot to read and learn now!



  4. #4
    Join Date
    Aug 2006
    Posts
    287

    Re: How To Dismiss a Dialog Box Displayed by an Office Application with Visual Basic?

    Study the object model of the Office application to see if there may be some property that prevents certain dialog boxes. For example, the Excel Application object has properties AskToUpdateLinks and AlertBeforeOverwriting. Set the property Application.DisplayAlerts (Excel, Project, Word) or use Application.DoCmd.SetWarnings False (only in Access) to turn off warning messages. Most of the dialog boxes can be avoided with this configuration, but not all.
    Dimension 1100 (FMY032J) mini-tower
    2.53ghz Intel Pentium 4
    80 gig nfts HDD
    512 RAM
    Main circuit board: Dell 0CF458
    BIOS: Dell A00
    Display: Intel(R) 82865G Graphics Controller [Display adaptor]
    Multimedia: Sound MAX Integrated Digital Audio
    Windows XP Home SP2

  5. #5
    Join Date
    Jul 2006
    Posts
    273

    Re: How To Dismiss a Dialog Box Displayed by an Office Application with Visual Basic?

    You can also try the method described by me for dismissing the dialog box. Use the On Error statement to avoid error messages at runtime which might arise, for example when trying to establish when there Application.ActivePrinter no printer driver installed on the user's system. Test the application thoroughly to help anticipate when dialog boxes may appear. For example, suppose you call the SaveAs method of an Office application to save a file. If that file already exists, you may receive a dialog box asking for confirmation to replace the existing file. If you modify the code to check the file before calling the SaveAs method, you can avoid the possibility of dialog box appears. For example, if the file already exists, delete it using the Kill statement before calling the SaveAs method.
    (\__/)
    (='.'=) This is Bunny. Copy and paste bunny into your
    (")_(") signatureto help him gain world domination

  6. #6
    Join Date
    Aug 2006
    Posts
    181

    Re: How To Dismiss a Dialog Box Displayed by an Office Application with Visual Basic?

    I am explaining you the logic of the dismissing a Dialog Box displayed by an Office Application with Visual Basic. The Automation client calls the method PrintOut Word Document object. If the user's default printer is configured to print to the FILE port, a call to PrintOut generates a dialog box that prompts the user to type a file name. To determine if the PrintOut method causes this dialog box appears, the automation client Visual Basic uses a Timer control to detect idle time after calling the PrintOut method. Before calling PrintOut, Timer is enabled and set to break out in five seconds. When PrintOut completes, Timer is disabled. Therefore, if the PrintOut method completes within five seconds, the Timer event never occurs and there is no other action. The document is printed and the code execution continues beyond the PrintOut method. However, if the Timer event occurs within the five-second interval, it is assumed that the PrintOut method has not been completed and that the delay is due to a dialog that waits for user input data. When the Timer event occurs, the Automation client gives focus to Word and uses SendKeys to dismiss the dialog.
    QTechnology Ultra-Quiet ATX PSU 460W I MSI K8N Neo4-F I AMD Opteron 144 CABNE0545 2.66Ghz I 2 x 512MB RAM I 380GB Maxtor SATAI Raid0 Hard Drive I 40GB Maxtor IDE Hard Drive I Nvidia GeForce 7900GTX I Win XP Home Service Pack 2 I Soundblaster Xtreme Fidelity Fatal1ty I Mercury Home Theater HT-4500

Similar Threads

  1. Tips for developing Visual Basic application
    By SpearMan in forum Tips & Tweaks
    Replies: 2
    Last Post: 23-04-2012, 03:05 PM
  2. How to create installation package of application in visual basic 6.0
    By Badrinath18 in forum Software Development
    Replies: 5
    Last Post: 02-07-2011, 07:28 PM
  3. What is the use of Dialog box in Visual Basic?
    By Alibamu in forum Software Development
    Replies: 5
    Last Post: 02-01-2011, 11:47 PM
  4. Access Outlook from Visual Basic Application
    By Ebenezer in forum Windows Software
    Replies: 3
    Last Post: 11-06-2009, 07:38 PM
  5. Visual Basic Error? in Microsoft Office 2003
    By CostasD in forum MS Office Support
    Replies: 5
    Last Post: 04-12-2008, 02:12 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,219,436.26920 seconds with 17 queries