Let's look at the command itself.

The "normal" syntax of the SaveAs procedure is:
ActiveWorkbook.SaveAs Filename:="C:\temp\NewFile.xls"

Now, if you have a variable called FileName, you could use:

FileName = "C:\temp\NewFile.xls"
ActiveWorkbook.SaveAs Filename:=FileName

But when you use:
ActiveWorkbook.SaveAs Filename:=Filename = InputBox("File name, please?")
You're telling VBA to compare what is entered in the Input box to the
value of the variable "Filename".
Your sub does not set a value for "Filename", so it compares whatever you enter
to "", and of course, it will be False (if you enter anything at all)

Either separate the two steps:
'-------------------------------------------- 
FileName = InputBox("File name, please?")
ActiveWorkbook.SaveAs Filename:=FileName 
'-------------------------------------------- 

or remove the variable altogether:

ActiveWorkbook.SaveAs Filename:= InputBox("File name, please?")


Paul

----- Original Message ----
> From: Rajesh K R <rajeshkainikk...@gmail.com>
> To: excel-macros@googlegroups.com
> Sent: Mon, December 20, 2010 8:28:51 AM
> Subject: Re: $$Excel-Macros$$ Create a new work book and copy the data from 
>theexcising work book
> 
> Hi
> I think using save as it can do, I crate a macro given below but its
> not working well
> Sub copyfile( )
> Dim Filename As String
> ActiveWorkbook.SaveAs Filename:=Filename = InputBox("File name, please?")
> 
> end sub
> it save the file in the name of False.xls always.Pls let me know what
> is the trouble.
> Regards
> Rajesh Kainikkara
> 
> On 12/18/10, in.vaib...@gmail.com <in.vaib...@gmail.com> wrote:
> > Yes,
> >
> > Send your data sheet with ur requirements.
> >
> > Sent on my BlackBerry® from Vodafone
> >
> > -----Original Message-----
> > From: Rajesh K R <rajeshkainikk...@gmail.com>
> > Sender: excel-macros@googlegroups.com
> > Date: Sat, 18 Dec 2010 17:24:19
> > To: excel-macros<excel-macros@googlegroups.com>
> > Reply-To: excel-macros@googlegroups.com
> > Subject: $$Excel-Macros$$ Create a new work book and copy the data from the
> >  excising work book
> >
> > Hi experts
> >
> > Is it possible to create a new work book and copy the required to it
> > from the excising file using a macro.
> >
> > Regards
> > Rajesh Kainikkara
> >
> > --
> > 
>----------------------------------------------------------------------------------
>
> > Some important links for excel users:
> > 1. Follow us on TWITTER for tips tricks and links :
> > http://twitter.com/exceldailytip
> > 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
> > 3. Excel tutorials at http://www.excel-macros.blogspot.com
> > 4. Learn VBA Macros at http://www.quickvba.blogspot.com
> > 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
> >
> > To post to this group, send email to excel-macros@googlegroups.com
> >
> > <><><><><><><><><><><><><><><><><><><><><><>
> > ; Like our page on facebook , Just follow below link
> > http://www.facebook.com/pages/discussexcelcom/160307843985936?v=wall&ref=ts
> >
> > --
> > 
>----------------------------------------------------------------------------------
>
> > Some important links for excel users:
> > 1. Follow us on TWITTER for tips tricks and links :
> > http://twitter.com/exceldailytip
> > 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
> > 3. Excel tutorials at http://www.excel-macros.blogspot.com
> > 4. Learn VBA Macros at http://www.quickvba.blogspot.com
> > 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
> >
> > To post to this group, send email to excel-macros@googlegroups.com
> >
> > <><><><><><><><><><><><><><><><><><><><><><>
> > ; Like our page on facebook , Just follow below link
> > http://www.facebook.com/pages/discussexcelcom/160307843985936?v=wall&ref=ts
> >
> 
> -- 
>----------------------------------------------------------------------------------
>-
> Some e important links for excel users:
> 1. Follow us on TWITTER for tips tricks and links : 
>http://twitter.com/exceldailytip
> 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
> 3. Excel tutorials at http://www.excel-macros.blogspot.com
> 4. Learn VBA Macros at http://www.quickvba.blogspot.com
> 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
> 
> To post to this group, send email to excel-macros@googlegroups.com
> 
> <><><><><><><><><><><><><><><><><><><><><><>
> Like our page on facebook , Just follow below link
> http://www.facebook.com/pages/discussexcelcom/160307843985936?v=wall&ref=ts
> 

-- 
----------------------------------------------------------------------------------
Some important links for excel users:
1. Follow us on TWITTER for tips tricks and links : 
http://twitter.com/exceldailytip
2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
3. Excel tutorials at http://www.excel-macros.blogspot.com
4. Learn VBA Macros at http://www.quickvba.blogspot.com
5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 
To post to this group, send email to excel-macros@googlegroups.com

<><><><><><><><><><><><><><><><><><><><><><>
Like our page on facebook , Just follow below link
http://www.facebook.com/pages/discussexcelcom/160307843985936?v=wall&ref=ts

Reply via email to