Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have several workbooks that I need to open each month. The paths for these
workbooks are in cells C12:D24 (each path is actually a concatenation since each file is updated monthly and then saved with a new name). When I run the code that I've written below, it keeps erroring on the line for "MsgBox "Check file: " & myFileNames(iCtr)." I'd really appreciate any help and/or suggestions for improvements. Sub OpenIBNRs() Dim myFileNames As Variant Dim myPasswords As Variant Dim iCtr As Long Dim wkbk As Workbook Application.DisplayAlerts = False 'turn warnings off myFileNames = Array(Range("c12:d24")) myPasswords = "password" For iCtr = LBound(myFileNames) To UBound(myFileNames) Set wkbk = Nothing On Error Resume Next ChDir "F:\EHP IBNR\" Set wkbk = Workbooks.Open(Filename:=myFileNames(iCtr), UpdateLinks:=3, _ ReadOnly:=False, Password:=myPasswords(iCtr), _ WriteResPassword:=myPasswords(iCtr)) Sheets("Summary").Select On Error GoTo 0 If wkbk Is Nothing Then MsgBox "Check file: " & myFileNames(iCtr) Exit Sub End If Next iCtr End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
macro or code to open multiple workbooks | Excel Discussion (Misc queries) | |||
open multiple workbooks not in same app. window | New Users to Excel | |||
open multiple workbooks at startup | Excel Discussion (Misc queries) | |||
Open Multiple Workbooks or Worksheets | Excel Programming | |||
Trying to Open Multiple WorkBooks w/ same beginning FileName | Excel Programming |