Caleeco
Well-known Member
- Joined
- Jan 9, 2016
- Messages
- 980
- Office Version
- 2010
- Platform
- Windows
Hello,
Not sure if im being dim, or this isnt possible. Here is my scenario:
This is what I have thus far. I dont think wb2 is running its own update macros, but I get this error upon copying the sheet:
Is it a sequence problem?
Any help is appreciated.
Thanks
Caleeco
Not sure if im being dim, or this isnt possible. Here is my scenario:
- 1 have an active workbook /dashboard (lets call it wb1)
- I need to duplicate a sheet from a closed workbook (Lets call it wb2) so that I can process its data
- wb2 has macros and a popup message box when opening. Once "ok" is hit on the msgbox, wb2 runs its own update macros
- I am trying to copy sheet-Deliverables from wb2 into wb1, but without having to "enable macros" or click "ok" on the message box
Code:
Sub copySheet()
Dim srcBook As Workbook
Const fromFile = "\\gbzdrpr-cfs010\SDRIVE\Programme Management\Deliverables\Deliverables Update.xlsm"
With Application
.DisplayAlerts = False
.ScreenUpdating = False
.EnableEvents = False
.AutomationSecurity = msoAutomationSecurityForceDisable
End With
Workbooks.Open fromFile, UpdateLinks:=True, ReadOnly:=True, AddToMRU:=False
Application.EnableEvents = True
Application.AutomationSecurity = msoAutomationSecurityByUI
Set srcBook = ActiveWorkbook
srcBook.Sheets("Deliverables").Copy After:=Workbooks("All Commodity SQCD Dashboard.xlsm").Sheets(Workbooks("All Commodity SQCD Dashboard.xlsm").Sheets.Count)
srcBook.Close False
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
This is what I have thus far. I dont think wb2 is running its own update macros, but I get this error upon copying the sheet:
Is it a sequence problem?
Any help is appreciated.
Thanks
Caleeco