VBA File Import to Another XLSM question

Pinaceous

Well-known Member
Joined
Jun 11, 2014
Messages
1,113
Office Version
  1. 365
Platform
  1. Windows
Hi All,

I'm using this code below to have the user import information onto their wook sheet. Working great!

Code:
    Dim sFilename As Variant
    Dim wsDest As Worksheet
    ChDrive "S:"
    ChDir "S:\GROUPS\Depts\ADMIN"
    
    sFilename = Application.GetOpenFilename("Excel Files, *.xlsm", , "SELECT File!!")
    If sFilename = False Then
        MsgBox "Not IMPORTING File!!", vbInformation, "ProtectUpdate!"
        Exit Sub
    End If
    
    Set wsDest = ActiveWorkbook.Sheets(10)
    
Application.ScreenUpdating = False
    On Error Resume Next
    With Workbooks.Open(sFilename)
        .Sheets(11).Range("A1:Q178").Copy wsDest.Range("A1:Q178")
        .Close False
    End With

Now, my question is; the file that they are importing is an macro enabled document that has MsgBox pop ups when that document is opened.

How would I disable the MsgBox popup that is part of its
auto open
for this file import because it is unnecessary to open this pop-up for import?



Thank you!
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
I'll try it now, lol, thank you!


It worked!
 
Last edited:
Upvote 0
Remember to put it back to True once you're done:

Code:
<code>Application.EnableEvents = False
Workbooks.Open "Example"</code>
<code>Application.EnableEvents = True</code>
 
Upvote 0

Forum statistics

Threads
1,215,603
Messages
6,125,788
Members
449,260
Latest member
Mrw1

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top