Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Setting a File name:
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Setting a string variable as the file name | Excel Discussion (Misc queries) | |||
File associate setting in Excel | Excel Discussion (Misc queries) | |||
Text file saving, setting file origin | Excel Discussion (Misc queries) | |||
How do i remove READ ONLY setting on a file? | Excel Discussion (Misc queries) | |||
Setting a password on a Single File Web Page (mht; mhtml file) | Excel Discussion (Misc queries) |