Setting a File name:
VariableName = ActiveWorkbook.Name
Then when you want to close it,
Workbooks(VariableName).Close SaveChanges:=True 'or false
Maybe add Application.CutCopyMode = False prior to closing
in case you have recently copied a large chunk of data.
-----Original Message-----
Hi guy's I'm looking for a little help,
What I am looking to do is set the name of the active
workbook as a variable,
The aim is that any one of a set number of files is
opened
(say File A), A set predetermined data is copied to
another file (File B), and the source file (File A) is to
be closed, I have been able to set most of the macro
however my problem is that the name of file a is
variable
and not likely to be used more than twice, I can set the
VBA to find the name of the file through (Windows
(ThisWorkbook.Name)), but I'm not sure how to set it as a
variable.
Any help in this matter would be appreciated.
Ben E
.
|