I have the following code:
If I dim the Excel filenames as constants and hard-code in the fname (which is just 2008 or 2008), the erro handler works, but if I use the above code with the fnames embedded in the strings, the errorhandler is ignored. Can I create a dynamic path based on the value of a combo box and call an error handler if the path doesn't exist?
Thanks,
Neuman
Code:
Dim fname As Integer fname = cboPlanYearBPTCreation.Value Dim BPTExcelFile As String BPTExcelFile = "C:\Program Files\PBP" & fname & "\CY" & fname & "MA BPT.xls" Dim BPTExcelXLA As String BPTExcelXLA = "C:\Program Files\bpt" & fname & "\BPT" & fname & ".xla" Dim App As Excel.Application Dim Wkbk As Excel.Workbook On Error GoTo ErrorHandler
Thanks,
Neuman
Comment