Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 519
Default Email Syntax error

Hello from Steved

On the below line I'm receivinfg a compile error Syntax error

",_

Would somebody be kind enough to point out to me please what is it that I'm
not getting right.

Thankyou.

Sub Mail_Todepot()
Dim wb As Workbook
Dim strdate As String

strdate = Format(Now, "dd-mm-yy")

Application.ScreenUpdating = False

Sheets("To Depot").Copy
ActiveSheet.Copy
Cells.Copy
Cells.PasteSpecial xlPasteValues
Cells(1).Select
Worksheets(1).Select
Application.CutCopyMode = False

Set wb = ActiveWorkbook
With wb

.SaveAs "C:/To Depots/Kilometres.xls"

",_

"Kilometres Per Bus"

.ChangeFileAccessxlReadOnly
Kill.FullName

.Close False

End With

Application.ScreenUpdating = True
End Sub



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Email Syntax error

Hi Steve

First you have two copy lines

Sheets("To Depot").Copy
ActiveSheet.Copy


remove the second one


.SaveAs "C:/To Depots/Kilometres.xls"

",_


Must be

.SendMail ", _
"Kilometres Per Bus"

note the space before the _


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Steved" wrote in message ...
Hello from Steved

On the below line I'm receivinfg a compile error Syntax error

",_

Would somebody be kind enough to point out to me please what is it that I'm
not getting right.

Thankyou.

Sub Mail_Todepot()
Dim wb As Workbook
Dim strdate As String

strdate = Format(Now, "dd-mm-yy")

Application.ScreenUpdating = False

Sheets("To Depot").Copy
ActiveSheet.Copy
Cells.Copy
Cells.PasteSpecial xlPasteValues
Cells(1).Select
Worksheets(1).Select
Application.CutCopyMode = False

Set wb = ActiveWorkbook
With wb

.SaveAs "C:/To Depots/Kilometres.xls"

",_

"Kilometres Per Bus"

.ChangeFileAccessxlReadOnly
Kill.FullName

.Close False

End With

Application.ScreenUpdating = True
End Sub





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 519
Default Email Syntax error

Hello Ron From Steved

this part of below Worksheets(1).Select gives me a run error 1004

Ron The macro copies the sheet too a new workbook, I am fine with that
but I do not want my origional workbook to copy, past special values, this is
sugguesting to me that i've not quiet got this correct.

In my mind I believe it should copy the worksheet named "To Depots" to a new
workbook which it is doing, question at this point can the macro then copy
past special value.

I thankyou

Cells.Copy
Cells.PasteSpecial xlPasteValues
Cells(1).Select
Worksheets(1).Select
Application.CutCopyMode = False




Sub Mail_Todepot()
Dim wb As Workbook
Dim strdate As String

strdate = Format(Now, "dd-mm-yy")

Application.ScreenUpdating = False

Sheets("To Depots").Copy

Cells.Copy
Cells.PasteSpecial xlPasteValues
Cells(1).Select
Worksheets(1).Select
Application.CutCopyMode = False

Set wb = ActiveWorkbook
With wb

.SendMail ", _
"Kilometres Per Bus"

.Close False

End With

Application.ScreenUpdating = True
End Sub







"Ron de Bruin" wrote:

Hi Steve

First you have two copy lines

Sheets("To Depot").Copy
ActiveSheet.Copy


remove the second one


.SaveAs "C:/To Depots/Kilometres.xls"

",_


Must be

.SendMail ", _
"Kilometres Per Bus"

note the space before the _


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Steved" wrote in message ...
Hello from Steved

On the below line I'm receivinfg a compile error Syntax error

",_

Would somebody be kind enough to point out to me please what is it that I'm
not getting right.

Thankyou.

Sub Mail_Todepot()
Dim wb As Workbook
Dim strdate As String

strdate = Format(Now, "dd-mm-yy")

Application.ScreenUpdating = False

Sheets("To Depot").Copy
ActiveSheet.Copy
Cells.Copy
Cells.PasteSpecial xlPasteValues
Cells(1).Select
Worksheets(1).Select
Application.CutCopyMode = False

Set wb = ActiveWorkbook
With wb

.SaveAs "C:/To Depots/Kilometres.xls"

",_

"Kilometres Per Bus"

.ChangeFileAccessxlReadOnly
Kill.FullName

.Close False

End With

Application.ScreenUpdating = True
End Sub






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Email Syntax error

Hi Steve

If you use this

Sheets("To Depots").Copy

It will create a new workbook with this sheet
The one sheet workbook is the active one now so you can use this to make values

Cells.Copy
Cells.PasteSpecial xlPasteValues
Cells(1).Select
Application.CutCopyMode = False


Have you try it ???


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Steved" wrote in message ...
Hello Ron From Steved

this part of below Worksheets(1).Select gives me a run error 1004

Ron The macro copies the sheet too a new workbook, I am fine with that
but I do not want my origional workbook to copy, past special values, this is
sugguesting to me that i've not quiet got this correct.

In my mind I believe it should copy the worksheet named "To Depots" to a new
workbook which it is doing, question at this point can the macro then copy
past special value.

I thankyou

Cells.Copy
Cells.PasteSpecial xlPasteValues
Cells(1).Select
Worksheets(1).Select
Application.CutCopyMode = False




Sub Mail_Todepot()
Dim wb As Workbook
Dim strdate As String

strdate = Format(Now, "dd-mm-yy")

Application.ScreenUpdating = False

Sheets("To Depots").Copy

Cells.Copy
Cells.PasteSpecial xlPasteValues
Cells(1).Select
Worksheets(1).Select
Application.CutCopyMode = False

Set wb = ActiveWorkbook
With wb

.SendMail ", _
"Kilometres Per Bus"

.Close False

End With

Application.ScreenUpdating = True
End Sub







"Ron de Bruin" wrote:

Hi Steve

First you have two copy lines

Sheets("To Depot").Copy
ActiveSheet.Copy


remove the second one


.SaveAs "C:/To Depots/Kilometres.xls"

",_


Must be

.SendMail ", _
"Kilometres Per Bus"

note the space before the _


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Steved" wrote in message ...
Hello from Steved

On the below line I'm receivinfg a compile error Syntax error

",_

Would somebody be kind enough to point out to me please what is it that I'm
not getting right.

Thankyou.

Sub Mail_Todepot()
Dim wb As Workbook
Dim strdate As String

strdate = Format(Now, "dd-mm-yy")

Application.ScreenUpdating = False

Sheets("To Depot").Copy
ActiveSheet.Copy
Cells.Copy
Cells.PasteSpecial xlPasteValues
Cells(1).Select
Worksheets(1).Select
Application.CutCopyMode = False

Set wb = ActiveWorkbook
With wb

.SaveAs "C:/To Depots/Kilometres.xls"

",_

"Kilometres Per Bus"

.ChangeFileAccessxlReadOnly
Kill.FullName

.Close False

End With

Application.ScreenUpdating = True
End Sub








  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 519
Default Email Syntax error

Hello Ron from Steved

The below is what I am running

two issues
1 when I run it I get a error 400

2 it values the sheet that it is copying from then creates a new workbook.

Sub Mail_Todepot()
Dim wb As Workbook
Dim strdate As String

strdate = Format(Now, "dd-mm-yy")

Application.ScreenUpdating = False

Sheets("To Depots").Copy

Cells.Copy
Cells.PasteSpecial xlPasteValues
Cells(1).Select
Application.CutCopyMode = False

Set wb = ActiveWorkbook
With wb


.SendMail ", _
"Kilometres Per Bus"

.Close False

End With

Application.ScreenUpdating = True
End Sub






"Ron de Bruin" wrote:

Hi Steve

If you use this

Sheets("To Depots").Copy

It will create a new workbook with this sheet
The one sheet workbook is the active one now so you can use this to make values

Cells.Copy
Cells.PasteSpecial xlPasteValues
Cells(1).Select
Application.CutCopyMode = False


Have you try it ???


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Steved" wrote in message ...
Hello Ron From Steved

this part of below Worksheets(1).Select gives me a run error 1004

Ron The macro copies the sheet too a new workbook, I am fine with that
but I do not want my origional workbook to copy, past special values, this is
sugguesting to me that i've not quiet got this correct.

In my mind I believe it should copy the worksheet named "To Depots" to a new
workbook which it is doing, question at this point can the macro then copy
past special value.

I thankyou

Cells.Copy
Cells.PasteSpecial xlPasteValues
Cells(1).Select
Worksheets(1).Select
Application.CutCopyMode = False




Sub Mail_Todepot()
Dim wb As Workbook
Dim strdate As String

strdate = Format(Now, "dd-mm-yy")

Application.ScreenUpdating = False

Sheets("To Depots").Copy

Cells.Copy
Cells.PasteSpecial xlPasteValues
Cells(1).Select
Worksheets(1).Select
Application.CutCopyMode = False

Set wb = ActiveWorkbook
With wb

.SendMail ", _
"Kilometres Per Bus"

.Close False

End With

Application.ScreenUpdating = True
End Sub







"Ron de Bruin" wrote:

Hi Steve

First you have two copy lines

Sheets("To Depot").Copy
ActiveSheet.Copy

remove the second one


.SaveAs "C:/To Depots/Kilometres.xls"

",_

Must be

.SendMail ", _
"Kilometres Per Bus"

note the space before the _


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Steved" wrote in message ...
Hello from Steved

On the below line I'm receivinfg a compile error Syntax error

",_

Would somebody be kind enough to point out to me please what is it that I'm
not getting right.

Thankyou.

Sub Mail_Todepot()
Dim wb As Workbook
Dim strdate As String

strdate = Format(Now, "dd-mm-yy")

Application.ScreenUpdating = False

Sheets("To Depot").Copy
ActiveSheet.Copy
Cells.Copy
Cells.PasteSpecial xlPasteValues
Cells(1).Select
Worksheets(1).Select
Application.CutCopyMode = False

Set wb = ActiveWorkbook
With wb

.SaveAs "C:/To Depots/Kilometres.xls"

",_

"Kilometres Per Bus"

.ChangeFileAccessxlReadOnly
Kill.FullName

.Close False

End With

Application.ScreenUpdating = True
End Sub











  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Email Syntax error

Send me the workbook private Steve
I will look at your problem tomorrow after work

--
Regards Ron de Bruin
http://www.rondebruin.nl


"Steved" wrote in message ...
Hello Ron from Steved

The below is what I am running

two issues
1 when I run it I get a error 400

2 it values the sheet that it is copying from then creates a new workbook.

Sub Mail_Todepot()
Dim wb As Workbook
Dim strdate As String

strdate = Format(Now, "dd-mm-yy")

Application.ScreenUpdating = False

Sheets("To Depots").Copy

Cells.Copy
Cells.PasteSpecial xlPasteValues
Cells(1).Select
Application.CutCopyMode = False

Set wb = ActiveWorkbook
With wb


.SendMail ", _
"Kilometres Per Bus"

.Close False

End With

Application.ScreenUpdating = True
End Sub






"Ron de Bruin" wrote:

Hi Steve

If you use this

Sheets("To Depots").Copy

It will create a new workbook with this sheet
The one sheet workbook is the active one now so you can use this to make values

Cells.Copy
Cells.PasteSpecial xlPasteValues
Cells(1).Select
Application.CutCopyMode = False


Have you try it ???


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Steved" wrote in message ...
Hello Ron From Steved

this part of below Worksheets(1).Select gives me a run error 1004

Ron The macro copies the sheet too a new workbook, I am fine with that
but I do not want my origional workbook to copy, past special values, this is
sugguesting to me that i've not quiet got this correct.

In my mind I believe it should copy the worksheet named "To Depots" to a new
workbook which it is doing, question at this point can the macro then copy
past special value.

I thankyou

Cells.Copy
Cells.PasteSpecial xlPasteValues
Cells(1).Select
Worksheets(1).Select
Application.CutCopyMode = False




Sub Mail_Todepot()
Dim wb As Workbook
Dim strdate As String

strdate = Format(Now, "dd-mm-yy")

Application.ScreenUpdating = False

Sheets("To Depots").Copy

Cells.Copy
Cells.PasteSpecial xlPasteValues
Cells(1).Select
Worksheets(1).Select
Application.CutCopyMode = False

Set wb = ActiveWorkbook
With wb

.SendMail ", _
"Kilometres Per Bus"

.Close False

End With

Application.ScreenUpdating = True
End Sub







"Ron de Bruin" wrote:

Hi Steve

First you have two copy lines

Sheets("To Depot").Copy
ActiveSheet.Copy

remove the second one


.SaveAs "C:/To Depots/Kilometres.xls"

",_

Must be

.SendMail ", _
"Kilometres Per Bus"

note the space before the _


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Steved" wrote in message ...
Hello from Steved

On the below line I'm receivinfg a compile error Syntax error

",_

Would somebody be kind enough to point out to me please what is it that I'm
not getting right.

Thankyou.

Sub Mail_Todepot()
Dim wb As Workbook
Dim strdate As String

strdate = Format(Now, "dd-mm-yy")

Application.ScreenUpdating = False

Sheets("To Depot").Copy
ActiveSheet.Copy
Cells.Copy
Cells.PasteSpecial xlPasteValues
Cells(1).Select
Worksheets(1).Select
Application.CutCopyMode = False

Set wb = ActiveWorkbook
With wb

.SaveAs "C:/To Depots/Kilometres.xls"

",_

"Kilometres Per Bus"

.ChangeFileAccessxlReadOnly
Kill.FullName

.Close False

End With

Application.ScreenUpdating = True
End Sub











  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 519
Default Email Syntax error

Thanks Ron

Before I do what you requested I'll going to try an idea.

because this is part of a workbook with many sheets I am going to

put it in a file off its own then work through What I am not doing correctly.

Cheers.


"Ron de Bruin" wrote:

Send me the workbook private Steve
I will look at your problem tomorrow after work

--
Regards Ron de Bruin
http://www.rondebruin.nl


"Steved" wrote in message ...
Hello Ron from Steved

The below is what I am running

two issues
1 when I run it I get a error 400

2 it values the sheet that it is copying from then creates a new workbook.

Sub Mail_Todepot()
Dim wb As Workbook
Dim strdate As String

strdate = Format(Now, "dd-mm-yy")

Application.ScreenUpdating = False

Sheets("To Depots").Copy

Cells.Copy
Cells.PasteSpecial xlPasteValues
Cells(1).Select
Application.CutCopyMode = False

Set wb = ActiveWorkbook
With wb


.SendMail ", _
"Kilometres Per Bus"

.Close False

End With

Application.ScreenUpdating = True
End Sub






"Ron de Bruin" wrote:

Hi Steve

If you use this

Sheets("To Depots").Copy

It will create a new workbook with this sheet
The one sheet workbook is the active one now so you can use this to make values

Cells.Copy
Cells.PasteSpecial xlPasteValues
Cells(1).Select
Application.CutCopyMode = False


Have you try it ???


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Steved" wrote in message ...
Hello Ron From Steved

this part of below Worksheets(1).Select gives me a run error 1004

Ron The macro copies the sheet too a new workbook, I am fine with that
but I do not want my origional workbook to copy, past special values, this is
sugguesting to me that i've not quiet got this correct.

In my mind I believe it should copy the worksheet named "To Depots" to a new
workbook which it is doing, question at this point can the macro then copy
past special value.

I thankyou

Cells.Copy
Cells.PasteSpecial xlPasteValues
Cells(1).Select
Worksheets(1).Select
Application.CutCopyMode = False




Sub Mail_Todepot()
Dim wb As Workbook
Dim strdate As String

strdate = Format(Now, "dd-mm-yy")

Application.ScreenUpdating = False

Sheets("To Depots").Copy

Cells.Copy
Cells.PasteSpecial xlPasteValues
Cells(1).Select
Worksheets(1).Select
Application.CutCopyMode = False

Set wb = ActiveWorkbook
With wb

.SendMail ", _
"Kilometres Per Bus"

.Close False

End With

Application.ScreenUpdating = True
End Sub







"Ron de Bruin" wrote:

Hi Steve

First you have two copy lines

Sheets("To Depot").Copy
ActiveSheet.Copy

remove the second one


.SaveAs "C:/To Depots/Kilometres.xls"

",_

Must be

.SendMail ", _
"Kilometres Per Bus"

note the space before the _


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Steved" wrote in message ...
Hello from Steved

On the below line I'm receivinfg a compile error Syntax error

",_

Would somebody be kind enough to point out to me please what is it that I'm
not getting right.

Thankyou.

Sub Mail_Todepot()
Dim wb As Workbook
Dim strdate As String

strdate = Format(Now, "dd-mm-yy")

Application.ScreenUpdating = False

Sheets("To Depot").Copy
ActiveSheet.Copy
Cells.Copy
Cells.PasteSpecial xlPasteValues
Cells(1).Select
Worksheets(1).Select
Application.CutCopyMode = False

Set wb = ActiveWorkbook
With wb

.SaveAs "C:/To Depots/Kilometres.xls"

",_

"Kilometres Per Bus"

.ChangeFileAccessxlReadOnly
Kill.FullName

.Close False

End With

Application.ScreenUpdating = True
End Sub












  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 519
Default Email Syntax error

Hello Ron from Steved

Ron I seperated out the worksheet to depots to a individual workbook

I then ran the macro and had no issues as you have designed it to do.

So the issue I have to fiquire is why will it not operate on multiple sheets.

I'll work on it hopping I can workout what I've done different.

Thankyou.


"Steved" wrote:

Thanks Ron

Before I do what you requested I'll going to try an idea.

because this is part of a workbook with many sheets I am going to

put it in a file off its own then work through What I am not doing correctly.

Cheers.


"Ron de Bruin" wrote:

Send me the workbook private Steve
I will look at your problem tomorrow after work

--
Regards Ron de Bruin
http://www.rondebruin.nl


"Steved" wrote in message ...
Hello Ron from Steved

The below is what I am running

two issues
1 when I run it I get a error 400

2 it values the sheet that it is copying from then creates a new workbook.

Sub Mail_Todepot()
Dim wb As Workbook
Dim strdate As String

strdate = Format(Now, "dd-mm-yy")

Application.ScreenUpdating = False

Sheets("To Depots").Copy

Cells.Copy
Cells.PasteSpecial xlPasteValues
Cells(1).Select
Application.CutCopyMode = False

Set wb = ActiveWorkbook
With wb


.SendMail ", _
"Kilometres Per Bus"

.Close False

End With

Application.ScreenUpdating = True
End Sub






"Ron de Bruin" wrote:

Hi Steve

If you use this

Sheets("To Depots").Copy

It will create a new workbook with this sheet
The one sheet workbook is the active one now so you can use this to make values

Cells.Copy
Cells.PasteSpecial xlPasteValues
Cells(1).Select
Application.CutCopyMode = False


Have you try it ???


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Steved" wrote in message ...
Hello Ron From Steved

this part of below Worksheets(1).Select gives me a run error 1004

Ron The macro copies the sheet too a new workbook, I am fine with that
but I do not want my origional workbook to copy, past special values, this is
sugguesting to me that i've not quiet got this correct.

In my mind I believe it should copy the worksheet named "To Depots" to a new
workbook which it is doing, question at this point can the macro then copy
past special value.

I thankyou

Cells.Copy
Cells.PasteSpecial xlPasteValues
Cells(1).Select
Worksheets(1).Select
Application.CutCopyMode = False




Sub Mail_Todepot()
Dim wb As Workbook
Dim strdate As String

strdate = Format(Now, "dd-mm-yy")

Application.ScreenUpdating = False

Sheets("To Depots").Copy

Cells.Copy
Cells.PasteSpecial xlPasteValues
Cells(1).Select
Worksheets(1).Select
Application.CutCopyMode = False

Set wb = ActiveWorkbook
With wb

.SendMail ", _
"Kilometres Per Bus"

.Close False

End With

Application.ScreenUpdating = True
End Sub







"Ron de Bruin" wrote:

Hi Steve

First you have two copy lines

Sheets("To Depot").Copy
ActiveSheet.Copy

remove the second one


.SaveAs "C:/To Depots/Kilometres.xls"

",_

Must be

.SendMail ", _
"Kilometres Per Bus"

note the space before the _


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Steved" wrote in message ...
Hello from Steved

On the below line I'm receivinfg a compile error Syntax error

",_

Would somebody be kind enough to point out to me please what is it that I'm
not getting right.

Thankyou.

Sub Mail_Todepot()
Dim wb As Workbook
Dim strdate As String

strdate = Format(Now, "dd-mm-yy")

Application.ScreenUpdating = False

Sheets("To Depot").Copy
ActiveSheet.Copy
Cells.Copy
Cells.PasteSpecial xlPasteValues
Cells(1).Select
Worksheets(1).Select
Application.CutCopyMode = False

Set wb = ActiveWorkbook
With wb

.SaveAs "C:/To Depots/Kilometres.xls"

",_

"Kilometres Per Bus"

.ChangeFileAccessxlReadOnly
Kill.FullName

.Close False

End With

Application.ScreenUpdating = True
End Sub












  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 519
Default Email Syntax error

Hello Ron from Steved

oops I forgot what you advised me to do, and that is make sure the macro is
in the right module. Thanks Ron as soon as you said that you would take a
look for me
I knew in my mind I better trace my steps and work it out for myself. I have
other situations where your good macro will help.

Have a nice day. and Once again thanks.

"Steved" wrote:

Hello Ron from Steved

Ron I seperated out the worksheet to depots to a individual workbook

I then ran the macro and had no issues as you have designed it to do.

So the issue I have to fiquire is why will it not operate on multiple sheets.

I'll work on it hopping I can workout what I've done different.

Thankyou.


"Steved" wrote:

Thanks Ron

Before I do what you requested I'll going to try an idea.

because this is part of a workbook with many sheets I am going to

put it in a file off its own then work through What I am not doing correctly.

Cheers.


"Ron de Bruin" wrote:

Send me the workbook private Steve
I will look at your problem tomorrow after work

--
Regards Ron de Bruin
http://www.rondebruin.nl


"Steved" wrote in message ...
Hello Ron from Steved

The below is what I am running

two issues
1 when I run it I get a error 400

2 it values the sheet that it is copying from then creates a new workbook.

Sub Mail_Todepot()
Dim wb As Workbook
Dim strdate As String

strdate = Format(Now, "dd-mm-yy")

Application.ScreenUpdating = False

Sheets("To Depots").Copy

Cells.Copy
Cells.PasteSpecial xlPasteValues
Cells(1).Select
Application.CutCopyMode = False

Set wb = ActiveWorkbook
With wb


.SendMail ", _
"Kilometres Per Bus"

.Close False

End With

Application.ScreenUpdating = True
End Sub






"Ron de Bruin" wrote:

Hi Steve

If you use this

Sheets("To Depots").Copy

It will create a new workbook with this sheet
The one sheet workbook is the active one now so you can use this to make values

Cells.Copy
Cells.PasteSpecial xlPasteValues
Cells(1).Select
Application.CutCopyMode = False


Have you try it ???


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Steved" wrote in message ...
Hello Ron From Steved

this part of below Worksheets(1).Select gives me a run error 1004

Ron The macro copies the sheet too a new workbook, I am fine with that
but I do not want my origional workbook to copy, past special values, this is
sugguesting to me that i've not quiet got this correct.

In my mind I believe it should copy the worksheet named "To Depots" to a new
workbook which it is doing, question at this point can the macro then copy
past special value.

I thankyou

Cells.Copy
Cells.PasteSpecial xlPasteValues
Cells(1).Select
Worksheets(1).Select
Application.CutCopyMode = False




Sub Mail_Todepot()
Dim wb As Workbook
Dim strdate As String

strdate = Format(Now, "dd-mm-yy")

Application.ScreenUpdating = False

Sheets("To Depots").Copy

Cells.Copy
Cells.PasteSpecial xlPasteValues
Cells(1).Select
Worksheets(1).Select
Application.CutCopyMode = False

Set wb = ActiveWorkbook
With wb

.SendMail ", _
"Kilometres Per Bus"

.Close False

End With

Application.ScreenUpdating = True
End Sub







"Ron de Bruin" wrote:

Hi Steve

First you have two copy lines

Sheets("To Depot").Copy
ActiveSheet.Copy

remove the second one


.SaveAs "C:/To Depots/Kilometres.xls"

",_

Must be

.SendMail ", _
"Kilometres Per Bus"

note the space before the _


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Steved" wrote in message ...
Hello from Steved

On the below line I'm receivinfg a compile error Syntax error

",_

Would somebody be kind enough to point out to me please what is it that I'm
not getting right.

Thankyou.

Sub Mail_Todepot()
Dim wb As Workbook
Dim strdate As String

strdate = Format(Now, "dd-mm-yy")

Application.ScreenUpdating = False

Sheets("To Depot").Copy
ActiveSheet.Copy
Cells.Copy
Cells.PasteSpecial xlPasteValues
Cells(1).Select
Worksheets(1).Select
Application.CutCopyMode = False

Set wb = ActiveWorkbook
With wb

.SaveAs "C:/To Depots/Kilometres.xls"

",_

"Kilometres Per Bus"

.ChangeFileAccessxlReadOnly
Kill.FullName

.Close False

End With

Application.ScreenUpdating = True
End Sub












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
Syntax Error help Markantesp Excel Programming 1 March 8th 05 09:51 PM
Syntax error Q John[_78_] Excel Programming 0 December 22nd 04 10:01 AM
Syntax error. David McNally Excel Programming 3 April 28th 04 02:57 AM
Syntax Error Runtime Error '424' Object Required sjenks183 Excel Programming 1 January 23rd 04 09:25 AM
Where is my syntax error? Mike Excel Programming 2 December 16th 03 10:43 PM


All times are GMT +1. The time now is 09:13 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"