VBA File Import to Another XLSM question

Pinaceous

Well-known Member
Joined
Jun 11, 2014
Messages
1,124
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

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
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,223,911
Messages
6,175,325
Members
452,635
Latest member
laura12345

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