PC Review


Reply
Thread Tools Rate Thread

Coding a filename into a macro

 
 
Guerilla
Guest
Posts: n/a
 
      16th Apr 2007
Hi,

I want to be able to move a selection of sheets to a new workbook, and
name the file (this does not change so I would declare this as a
string - I think), however, I would like the newly created file to be
saved in the current directory (the directory of the original file).
How can I do this?

Also,
In case I don't figure it out, what is the code for setting the
filename in the macro?

kind regards,

Matt

 
Reply With Quote
 
 
 
 
JE McGimpsey
Guest
Posts: n/a
 
      16th Apr 2007
One way:

Const csFILENAME As String = "MyBook.xls"

With ThisWorkbook
.SaveAs Filename:=.Path & Application.PathSeparator & csFILENAME
End With


In article <(E-Mail Removed)>,
"Guerilla" <(E-Mail Removed)> wrote:

> Hi,
>
> I want to be able to move a selection of sheets to a new workbook, and
> name the file (this does not change so I would declare this as a
> string - I think), however, I would like the newly created file to be
> saved in the current directory (the directory of the original file).
> How can I do this?
>
> Also,
> In case I don't figure it out, what is the code for setting the
> filename in the macro?
>
> kind regards,
>
> Matt

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro coding Flipper Microsoft Excel Programming 3 28th Oct 2009 01:59 AM
output to - filename coding Jake F Microsoft Access Form Coding 6 11th Jan 2008 10:31 PM
Filename coding with date =?Utf-8?B?RGVhblQ=?= Microsoft Excel Programming 2 28th Nov 2006 11:23 PM
Why does the Hyperlink view as coding eg: {hyperlink /filename} =?Utf-8?B?bWF6dXJh?= Microsoft Word New Users 1 14th Sep 2005 08:49 AM
Help please with coding a macro =?Utf-8?B?dXNlUg==?= Microsoft Excel Programming 3 8th Aug 2005 09:02 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:35 AM.