J
John Kitchens
Hello,
I have a macro that when prompted opens up many different files that are
located in the same folder.
Each of these files that I am opening are files that have been previously
summarized through the use of a macro.
Example: I wll have 40 to 60 files that I save in the same folder on a daily
basis. At the end of the day I use a template and a macro that will open
all of the daily files and summarize them into one neat sheet for me. When
this macro is executed all of the 40 to 60 daily files are opened to give me
the total of my daily summary sheet.
I save each of these daily summaries as DS100104.xls etc, tommorrow
DS100204.xls etc.
Now what I have created a new template that will be a weekly, monthly,
quarterly and so forth summary.
I have modified the macro so that it will open page 1 of the DS files. It
works, but I am getting the following message when I open the DS files:
"Microsoft Excel"
"The workbook you opened contains automatic links to information in another
workbook. Do you want to update this workbook with changed made to the other
workbook?"
"To update all linked information, click Yes.
To keep the existing information, click No."
This is a copy of the macro that runs my program:
Sub GetSheets()
Dim i As Long
Dim varr As Variant
Dim wkbk As Workbook
Dim ws As Worksheet
Application.DisplayAlerts = False
varr = Application.GetOpenFilename(filefilter:="Excel Files, *.xls", _
MultiSelect:=True)
If IsArray(varr) Then
For i = LBound(varr) To UBound(varr)
Set wkbk = Workbooks.Open(varr(i))
Set ws = wkbk.Sheets("Summary")
ws.Unprotect
ws.Name = Left(wkbk.Name, Len(wkbk.Name) - 4)
ws.Cells.Style = "Normal"
ws.DrawingObjects.Delete
ws.Copy After:=ThisWorkbook.Worksheets("Start")
wkbk.Close SaveChanges:=False
Next
End If
Application.DisplayAlerts = True
End Sub
Sub UnhideSheets()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Sheets
ws.Visible = xlSheetVisible
Next ws
End Sub
I am hoping that this macro can be modified so that "No" will automatically
be selected for each sheet so that the user doesn't have to click it each
time.
Thanks for any help I can get.
John
I have a macro that when prompted opens up many different files that are
located in the same folder.
Each of these files that I am opening are files that have been previously
summarized through the use of a macro.
Example: I wll have 40 to 60 files that I save in the same folder on a daily
basis. At the end of the day I use a template and a macro that will open
all of the daily files and summarize them into one neat sheet for me. When
this macro is executed all of the 40 to 60 daily files are opened to give me
the total of my daily summary sheet.
I save each of these daily summaries as DS100104.xls etc, tommorrow
DS100204.xls etc.
Now what I have created a new template that will be a weekly, monthly,
quarterly and so forth summary.
I have modified the macro so that it will open page 1 of the DS files. It
works, but I am getting the following message when I open the DS files:
"Microsoft Excel"
"The workbook you opened contains automatic links to information in another
workbook. Do you want to update this workbook with changed made to the other
workbook?"
"To update all linked information, click Yes.
To keep the existing information, click No."
This is a copy of the macro that runs my program:
Sub GetSheets()
Dim i As Long
Dim varr As Variant
Dim wkbk As Workbook
Dim ws As Worksheet
Application.DisplayAlerts = False
varr = Application.GetOpenFilename(filefilter:="Excel Files, *.xls", _
MultiSelect:=True)
If IsArray(varr) Then
For i = LBound(varr) To UBound(varr)
Set wkbk = Workbooks.Open(varr(i))
Set ws = wkbk.Sheets("Summary")
ws.Unprotect
ws.Name = Left(wkbk.Name, Len(wkbk.Name) - 4)
ws.Cells.Style = "Normal"
ws.DrawingObjects.Delete
ws.Copy After:=ThisWorkbook.Worksheets("Start")
wkbk.Close SaveChanges:=False
Next
End If
Application.DisplayAlerts = True
End Sub
Sub UnhideSheets()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Sheets
ws.Visible = xlSheetVisible
Next ws
End Sub
I am hoping that this macro can be modified so that "No" will automatically
be selected for each sheet so that the user doesn't have to click it each
time.
Thanks for any help I can get.
John