Hi Croney,
One way is to have a datasheet in the workbook where the macros are and
store the name of the file as in:
1. name the sheet "data"
2. in column 1 give names
3. say a5="File to read"
4. say B5="C:\CABD\CABD.xls"
Ok this has set up the data, we now need the code:
In a code module I call it globals enter the following:
' the name of the sheet where the filename is
Public Const cszDataSheet As String = "data"
' the cell where the filename is
Public Const cszCellFileNameIn As String = "B5"
This sets up the references to the the data sheet and the cells where the
data are.
Then in your code:
Dim CWDBXLS As String
CWDBXLS = ThisWorkbook.Worksheets( _
cszDataSheet).Range(cszCellFileNameIn)
Workbooks.Open Filename:=CWDBXLS
or :
Workbooks.Open Filename:=ThisWorkbook.Worksheets( _
cszDataSheet).Range(cszCellFileNameIn)
--
Hope this helps
Martin Fishlock, Bangkok, Thailand
Please do not forget to rate this reply.
"croney" wrote:
Thank you very much for a very thorough answer. Is there a way to get
a particular cell's value on my spreadsheet to be the default? In other
words, a value not hardcoded into the VBA.
--
croney
------------------------------------------------------------------------
croney's Profile: http://www.officehelp.in/member.php?userid=5986
View this thread: http://www.officehelp.in/showthread.php?t=1318743
Posted from - http://www.officehelp.in