Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting a string variable as the file name [email protected] Excel Discussion (Misc queries) 1 March 28th 07 11:10 PM
File associate setting in Excel jim28 Excel Discussion (Misc queries) 4 June 21st 06 03:27 AM
Text file saving, setting file origin mauddib Excel Discussion (Misc queries) 0 May 25th 06 02:50 PM
How do i remove READ ONLY setting on a file? Andrea Excel Discussion (Misc queries) 1 March 14th 06 12:57 PM
Setting a password on a Single File Web Page (mht; mhtml file) sinplicity Excel Discussion (Misc queries) 0 November 3rd 05 02:59 PM


All times are GMT +1. The time now is 10:25 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"