Hi Prabhu

check path of your file
sPath = ThisWorkbook.Path & "D:\Reports\"

*should be*

sPath = "D:\Reports\"

Thanks
Mahesh

On Wed, Aug 31, 2011 at 11:25 PM, Prabhu <prabhugate...@gmail.com> wrote:

> Hi Ashish,
>
> Same Run time error "1004"
>
>    - Make sure the specified folder is exists
>    - Make sure the folder that contains the file is not read-only
>    - Make sure the file name does not contain any of the following
>    characters< > ? [ ] :| or *
>
>
>
> Debug shows the below yellow mark line item.
>
>
> Sub Mtest()
> Dim sPath As String, sFname As String
> sPath = ThisWorkbook.Path & "D:\Reports\"
> sFname = "Statement as on " & Format(Date, "mm-dd-yyyy")
> With ThisWorkbook
> Sheets(Array(ActiveSheet.Name, ActiveSheet.Previous.Name)).Select
> Sheets(Array(ActiveSheet.Name, ActiveSheet.Previous.Name)).Copy
> End With
> ActiveWorkbook.SaveAs (sPath & sFname)
> ActiveWorkbook.Close True
> Application.DisplayAlerts = False
> End Sub
>
>  --
>
> ----------------------------------------------------------------------------------
> 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/discussexcel
>

-- 
----------------------------------------------------------------------------------
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/discussexcel

Reply via email to