filename and path as constant

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
 
R

Rob van Gelder

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top