By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,287 Members | 1,665 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,287 IT Pros & Developers. It's quick & easy.

File Not Found Error on String File reference

P: 1
I have the following code:
Expand|Select|Wrap|Line Numbers
  1. Dim fname As Integer
  2. fname = cboPlanYearBPTCreation.Value
  4. Dim BPTExcelFile As String
  5. BPTExcelFile = "C:\Program Files\PBP" & fname & "\CY" & fname & "MA BPT.xls"
  6. Dim BPTExcelXLA As String
  7. BPTExcelXLA = "C:\Program Files\bpt" & fname & "\BPT" & fname & ".xla"
  9. Dim App As Excel.Application
  10. Dim Wkbk As Excel.Workbook
  12. On Error GoTo ErrorHandler
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?

Feb 18 '08 #1
Share this Question
Share on Google+
2 Replies

Expert 2.5K+
P: 2,653
Hello, Neuman.

Are you sure that the error occurs after "On Error" statement has been executed?

Feb 18 '08 #2

Expert Mod 15k+
P: 31,768
What do you mean by "the error handler works" and "call an error handler"?
I'm having difficulty understanding what you mean when you describe what's going wrong.
Feb 22 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.