Combining Information from Multiple Workbooks - Data Link Properties Error

Jimdandy527

New Member
Joined
Oct 3, 2013
Messages
9
I am seriously stuck!

I have several workbooks within a given folder. The code below has worked without issue in the past, so I need help with troubleshooting whatever apparently changed. The problem seems to be that in the process of opening and closing the various workbooks, there is a data link properties box that pops up. I have never seen this before and if I cancel out it, I receive a run time 1004 error. The line that bugs out is in bold below.

Please point me in the right direction. Many Thanks - john

Code:
Sub MergeBooks()Dim booklist As Workbook
Dim mergeobj As Object, dirobject As Object, filesobj As Object, everyobj As Object
Application.ScreenUpdating = False
Set mergeobj = CreateObject("scripting.filesystemobject")


Set dirobj = mergeobj.getfolder("C:\Documents and Settings\User\Desktop\AMMENDED MAY")
Set filesobj = dirobj.Files
For Each everyobj In filesobj
[B]Set booklist = Workbooks.Open(everyobj)[/B]
booklist.Sheets(1).Select
Call Module1.UnProtect1
Range("D215").Value = 1
Call Module1.Format1
Call Module1.Format2
Call Module1.UnlockUnhide
Call Module1.Protect1


Range("D1:BA1" & Range("A65536").End(xlUp).Row).Copy


ThisWorkbook.Worksheets(1).Activate


Range("D65536").End(xlUp).Offset(1, 0).PasteSpecial xlPasteAll






Application.CutCopyMode = False
booklist.Close
Next


Call MergeBooks1
Call MergeBooks2
Columns("BB:BC").Select
    With Selection.Font
        .ThemeColor = xlThemeColorDark1
        .TintAndShade = 0
    End With
    Selection.EntireColumn.Hidden = True
Call DeleteEmptyRows
Call Module1.Format3


Call MergeBooksVisual
Call MergeBooksBreakers
Call MergeBooksXfmrStatus
Call MergeBooksXfmrMeter
Call ProtectBooks
Range("A1").Select


End Sub
 

Some videos you may like

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop

Watch MrExcel Video

Forum statistics

Threads
1,108,614
Messages
5,523,911
Members
409,542
Latest member
Shezz01

This Week's Hot Topics

Top