+ Reply to Thread
Results 1 to 7 of 7

How to disable application alerts On workbook opening!

Hybrid View

  1. #1
    Registered User
    Join Date
    01-28-2007
    Posts
    12

    Question How to disable application alerts On workbook opening!

    I have an event for application.workbook opening..
    On open it identifies the opened workbook and does needed things..
    To this point it's ok, except when i try to open file.xml in excel.

    There is a popupbox which i would like to, application.display.alerts = false..

    Popup:

    OPEN XML
    Please select how you would like to open this file:
    O As an XML list
    O As a read-only workbook
    O Use the XML Source task pane


    The first option is the one i want to be "chosen silently"

    Thx.

  2. #2
    Forum Expert
    Join Date
    11-23-2005
    Location
    Rome
    MS-Off Ver
    Ms Office 2016
    Posts
    1,628
    You can use this code:

    Application.DisplayAlerts = False
    Workbooks.OpenXML Filename:="C:\<path and file name>.xml", _
       LoadOption:=xlXmlLoadImportToList
    Application.DisplayAlerts = True
    It seems to work fine.

    Regards,
    Antonio

  3. #3
    Registered User
    Join Date
    01-28-2007
    Posts
    12
    Thanks but the thing is that the code doesn't open the file.xml. I have a separate program which opens the files to excel. Just like double clicking file.xml.

    I got some hint from you post but keep on helping if you know a way.

    Maybe generally setting LoadOption:=xlXmlLoadImportToList?

    I have this evenclass workbook open whenever i run the program which opens file.xml to excel. So the thing Im looking for should be located there.

  4. #4
    Registered User
    Join Date
    01-28-2007
    Posts
    12
    Eventclass workbook has this code:

    Option Explicit
    
    Dim AppClass As New EventClass
    
    Private Sub workbook_Open()
    
    Set AppClass.App = Application
    
    End Sub
    EventClass has this code:
    Option Explicit
    
    Public WithEvents App As Application
    
    
    Private Sub App_WorkbookOpen(ByVal Wb As Excel.Workbook)
    
    Run macro:="personal.xls!mymacro"
    
    End Sub

  5. #5
    Registered User
    Join Date
    01-28-2007
    Posts
    12

    Angry

    How do i get a macro which runs in a open workbook and when a .xml-file is opened ( just like double clicking a file ) into excel this macro automatically sets LoadOption:=xlXmlLoadImportToList and I don't get popup wich tells me to choose! Please!

  6. #6
    Registered User
    Join Date
    08-08-2014
    Location
    Hannover
    MS-Off Ver
    2007
    Posts
    1

    Re: How to disable application alerts On workbook opening!

    Quote Originally Posted by Korjaaja View Post
    How do i get a macro which runs in a open workbook and when a .xml-file is opened ( just like double clicking a file ) into excel this macro automatically sets LoadOption:=xlXmlLoadImportToList and I don't get popup wich tells me to choose! Please!
    Hi Korjaaja, did you ever get a solution to this issue ? I am at the same point and cannot identify any way forward....

  7. #7
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: How to disable application alerts On workbook opening!

    Hi, Molli,

    Unfortunately your post does not comply with Rule 2 of our Forum RULES. Do not post a question in the thread of another member -- start your own thread.

    If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread.

    Old threads are often only monitored by the original participants. New threads not only open you up to all possible participants again, they typically get faster response, too.

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1