Results 1 to 1 of 1

Prevent Open Resource Pool Dialogue box when opening MPP Project File using VBA

Threaded View

  1. #1
    Registered User
    Join Date
    08-15-2012
    Location
    Midlands
    MS-Off Ver
    Excel 2003
    Posts
    2

    Prevent Open Resource Pool Dialogue box when opening MPP Project File using VBA

    Hi

    I have some code that I am using to Open a Microsoft Project file but despite all efforts I have been unable to prevent the opening dialogue box from appearing or auto answering it.

    I have tried "Application.EnableEvents = False", "Application.DisplayAlerts = False" and .FileOpenEx all to no avail.

    I would appreciate some help. Thanks in advance.

        Public Sub extract_data()
        
        Dim appProj As MSProject.Application
        Dim aProg As MSProject.Project
        Dim app
        Dim mppApp As MSProject.Application
        Dim Tasks As Tasks
        Dim mpp_file_name As String
        Dim j As Integer
            
            Set destination_ws = ThisWorkbook.Worksheets("Imported Vehicles")
            destination_ws.Cells.Clear
            
            file_location = ThisWorkbook.Worksheets("Control Panel").Range("F19").Value
            file_name = ThisWorkbook.Worksheets("Control Panel").Range("F20").Value
            file_location_and_name = file_location & file_name
            
            Set appProj = CreateObject("Msproject.Application")
               
            '---------------------------------------------------------------------
            'Set appProj = GetObject(, "MSProject.Application")
            'If IsEmpty(appProj) Then Set appProj = CreateObject("MSProject.Application")
            'appProj.FileOpenEx Name:=file_location_and_name, ReadOnly:=True
            '---------------------------------------------------------------------
            
            Application.EnableEvents = True
            Set mppApp = CreateObject("msproject.application")
            
            mppApp.DisplayAlerts = False
            mppApp.FileOpen Name:=file_location_and_name, ReadOnly:=True ' Opens file as Read Only
            
            mppApp.DisplayAlerts = False
            Application.EnableEvents = True
            
            '--------------------------- WAIT FOR IE TO CATCH UP --------------------------
            newHour = Hour(Now())
            newMinute = Minute(Now())
            newSecond = Second(Now()) + 3
            waitTime = TimeSerial(newHour, newMinute, newSecond)
            Application.Wait waitTime
            '------------------------------------------------------------------------------
            
            Set aProg = mppApp.ActiveProject
            'aProg.Visible = True
            
            'Application.SendKeys "{TAB}"   'Enter to OK
            'Application.SendKeys "^~"   'Enter yes to OK
            
            'COPY DATA ACROSS code
    
            Set mpApp = Nothing
            DoEvents
            MsgBox "Data from MS Project File Copied", vbInformation    
        End Sub
    Attached Images Attached Images

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Copy cells to specific file using open dialogue box.
    By Bflare in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-28-2013, 10:22 AM
  2. VBA Cancelling the Open File Dialogue
    By Mase123y in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-20-2009, 01:37 PM
  3. [SOLVED] Sort order in File Open dialogue box
    By Roberto in forum Excel General
    Replies: 1
    Last Post: 12-11-2005, 08:50 PM
  4. Replies: 1
    Last Post: 10-18-2005, 11:05 AM
  5. [SOLVED] dialogue box / pop-up upon opening file - URGENT
    By marika1981 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-03-2005, 03:06 PM

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1