![]() |
Open Workbook Using VBA
Dear All,
I want to open an additional workbook using VBA. 'Where I get file name; This works txtTradeTrackerFile = ThisWorkbook.Worksheets("Access").Cells(3, 5) 'I don't know how to solve this cause of error in my project 'It works in Access. However, in Excel I really don't know :-) Set xBook = Workbooks.Open(CurrentProject.Path + "\" + txtTradeTrackerFile) Please give me suggestion. Thanks, March |
Open Workbook Using VBA
Set xBook = Workbooks.Open(ThisWorkbook.Path & Application.PathSeparator &
txtTradeTrackerFile) -- --- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "March" wrote in message ... Dear All, I want to open an additional workbook using VBA. 'Where I get file name; This works txtTradeTrackerFile = ThisWorkbook.Worksheets("Access").Cells(3, 5) 'I don't know how to solve this cause of error in my project 'It works in Access. However, in Excel I really don't know :-) Set xBook = Workbooks.Open(CurrentProject.Path + "\" + txtTradeTrackerFile) Please give me suggestion. Thanks, March |
Open Workbook Using VBA
You are close...
txtTradeTrackerFile = ThisWorkbook.Worksheets("Access").Cells(3, 5) on error resume next Set xBook = Workbooks.Open(thisworkbook.Path & "\" & txtTradeTrackerFile) on error goto 0 if xbook is nothing then msgbox "the book was not successfully opened" end if -- HTH... Jim Thomlinson "March" wrote: Dear All, I want to open an additional workbook using VBA. 'Where I get file name; This works txtTradeTrackerFile = ThisWorkbook.Worksheets("Access").Cells(3, 5) 'I don't know how to solve this cause of error in my project 'It works in Access. However, in Excel I really don't know :-) Set xBook = Workbooks.Open(CurrentProject.Path + "\" + txtTradeTrackerFile) Please give me suggestion. Thanks, March |
Open Workbook Using VBA
Thank you so much.
"Jim Thomlinson" wrote: You are close... txtTradeTrackerFile = ThisWorkbook.Worksheets("Access").Cells(3, 5) on error resume next Set xBook = Workbooks.Open(thisworkbook.Path & "\" & txtTradeTrackerFile) on error goto 0 if xbook is nothing then msgbox "the book was not successfully opened" end if -- HTH... Jim Thomlinson "March" wrote: Dear All, I want to open an additional workbook using VBA. 'Where I get file name; This works txtTradeTrackerFile = ThisWorkbook.Worksheets("Access").Cells(3, 5) 'I don't know how to solve this cause of error in my project 'It works in Access. However, in Excel I really don't know :-) Set xBook = Workbooks.Open(CurrentProject.Path + "\" + txtTradeTrackerFile) Please give me suggestion. Thanks, March |
All times are GMT +1. The time now is 08:16 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com