filename and path as constant

  • Thread starter Thread starter mark kubicki
  • Start date Start date
M

mark kubicki

easy...

can i define a filename and/or path as a constant?
ex:
Public JobNosDataFile As String
JobNosDataFile = "Job Nos for Timesheets.xls"
Public JobNosDataFilePath As String
JobNosDataFilePath = "\\Server\Files\@ Timesheets\"

can a refernece the name and path like this:
If IsFileOpen("JobNosDataFilePath" & "JobNosDataFile") Then
Workbooks("JobNosDataFile").Save
Workbooks("JobNosDataFile").Close

thanks in advance,
mark
 
Mark,

You sure can!

Public Const JobNosDataFile As String = "Job Nos for Timesheets.xls"
Public Const JobNosDataFilePath As String = "\\Server\Files\@
Timesheets\"

If IsFileOpen(JobNosDataFilePath & JobNosDataFile) Then
Workbooks(JobNosDataFile).Save
Workbooks(JobNosDataFile).Close
End If

Rob
 
Back
Top