Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Emailing From Excel

I have set up a macro that emails a sheet and retains the name of the
workbook in the subject line when Outlook is opened. I would like for it to
retain the name of the workbook, but I want to add the data from a particular
cell to the subject line as well.

Subject line example: NISR05 - Plastic Cup

Where "NISR05" is the name of the workbook and "Plastic Cup" is the data
located in cell B4.

Any help would be greatly appreciated!

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Emailing From Excel

I use sendMail. In fact, I found a macro that you wrote and am trying to
masage it for what I am doing (with some, but not total success).

Sub Mail_Every_Worksheet()
Dim sh As Worksheet
Dim wb As Workbook
Dim strdate As String
Application.ScreenUpdating = False
For Each sh In ThisWorkbook.Worksheets
If sh.Range("a1").Value Like "?*@?*.?*" Then
strdate = Format(Now, "dd-mm-yy h-mm-ss")
sh.Copy
Set wb = ActiveWorkbook
With wb
.SaveAs "Sheet " & sh.Name & " of " _
& ThisWorkbook.Name & " " & strdate & ".xls"
.SendMail ActiveSheet.Range("a1").Value, _
"NISR05" & " " & "-" & " " & sh.Range("b4")
.ChangeFileAccess xlReadOnly
Kill .FullName
.Close False
End With
End If
Next sh
Application.ScreenUpdating = True
End Sub

I do not want to specify the email address - I would like for the user to
type it in.

"Ron de Bruin" wrote:

Hi Cris
Do you use sendMail or Outlook code

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



"Chris Brown" <Chris wrote in message ...
I have set up a macro that emails a sheet and retains the name of the
workbook in the subject line when Outlook is opened. I would like for it to
retain the name of the workbook, but I want to add the data from a particular
cell to the subject line as well.

Subject line example: NISR05 - Plastic Cup

Where "NISR05" is the name of the workbook and "Plastic Cup" is the data
located in cell B4.

Any help would be greatly appreciated!




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Emailing From Excel

Hi Chris

Try this

..SendMail "", _
Left(ThisWorkbook.Name, Len(ThisWorkbook.Name) - 4) & " - " & sh.Range("b4").Value


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



"Chris Brown" wrote in message ...
I use sendMail. In fact, I found a macro that you wrote and am trying to
masage it for what I am doing (with some, but not total success).

Sub Mail_Every_Worksheet()
Dim sh As Worksheet
Dim wb As Workbook
Dim strdate As String
Application.ScreenUpdating = False
For Each sh In ThisWorkbook.Worksheets
If sh.Range("a1").Value Like "?*@?*.?*" Then
strdate = Format(Now, "dd-mm-yy h-mm-ss")
sh.Copy
Set wb = ActiveWorkbook
With wb
.SaveAs "Sheet " & sh.Name & " of " _
& ThisWorkbook.Name & " " & strdate & ".xls"
.SendMail ActiveSheet.Range("a1").Value, _
"NISR05" & " " & "-" & " " & sh.Range("b4")
.ChangeFileAccess xlReadOnly
Kill .FullName
.Close False
End With
End If
Next sh
Application.ScreenUpdating = True
End Sub

I do not want to specify the email address - I would like for the user to
type it in.

"Ron de Bruin" wrote:

Hi Cris
Do you use sendMail or Outlook code

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



"Chris Brown" <Chris wrote in message ...
I have set up a macro that emails a sheet and retains the name of the
workbook in the subject line when Outlook is opened. I would like for it to
retain the name of the workbook, but I want to add the data from a particular
cell to the subject line as well.

Subject line example: NISR05 - Plastic Cup

Where "NISR05" is the name of the workbook and "Plastic Cup" is the data
located in cell B4.

Any help would be greatly appreciated!






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Emailing From Excel

I'm still learning the VBA side. How do I load the code you provided? I
know I still need the Sub and End Sub - I just don't know where to put
...SendMail "", _
Left(ThisWorkbook.Name, Len(ThisWorkbook.Name) - 4) & " - " &
sh.Range("b4").Value




"Ron de Bruin" wrote:

Hi Chris

Try this

..SendMail "", _
Left(ThisWorkbook.Name, Len(ThisWorkbook.Name) - 4) & " - " & sh.Range("b4").Value


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



"Chris Brown" wrote in message ...
I use sendMail. In fact, I found a macro that you wrote and am trying to
masage it for what I am doing (with some, but not total success).

Sub Mail_Every_Worksheet()
Dim sh As Worksheet
Dim wb As Workbook
Dim strdate As String
Application.ScreenUpdating = False
For Each sh In ThisWorkbook.Worksheets
If sh.Range("a1").Value Like "?*@?*.?*" Then
strdate = Format(Now, "dd-mm-yy h-mm-ss")
sh.Copy
Set wb = ActiveWorkbook
With wb
.SaveAs "Sheet " & sh.Name & " of " _
& ThisWorkbook.Name & " " & strdate & ".xls"
.SendMail ActiveSheet.Range("a1").Value, _
"NISR05" & " " & "-" & " " & sh.Range("b4")
.ChangeFileAccess xlReadOnly
Kill .FullName
.Close False
End With
End If
Next sh
Application.ScreenUpdating = True
End Sub

I do not want to specify the email address - I would like for the user to
type it in.

"Ron de Bruin" wrote:

Hi Cris
Do you use sendMail or Outlook code

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



"Chris Brown" <Chris wrote in message ...
I have set up a macro that emails a sheet and retains the name of the
workbook in the subject line when Outlook is opened. I would like for it to
retain the name of the workbook, but I want to add the data from a particular
cell to the subject line as well.

Subject line example: NISR05 - Plastic Cup

Where "NISR05" is the name of the workbook and "Plastic Cup" is the data
located in cell B4.

Any help would be greatly appreciated!









  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Emailing From Excel

Replace the sendmail line in the code example you posted with the new line I posted

so replace

.SendMail ActiveSheet.Range("a1").Value, _
"NISR05" & " " & "-" & " " & sh.Range("b4")


for

..SendMail "", _
Left(ThisWorkbook.Name, Len(ThisWorkbook.Name) - 4) & " - " & sh.Range("b4").Value



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



"Chris Brown" wrote in message ...
I'm still learning the VBA side. How do I load the code you provided? I
know I still need the Sub and End Sub - I just don't know where to put
..SendMail "", _
Left(ThisWorkbook.Name, Len(ThisWorkbook.Name) - 4) & " - " &
sh.Range("b4").Value




"Ron de Bruin" wrote:

Hi Chris

Try this

..SendMail "", _
Left(ThisWorkbook.Name, Len(ThisWorkbook.Name) - 4) & " - " & sh.Range("b4").Value


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



"Chris Brown" wrote in message ...
I use sendMail. In fact, I found a macro that you wrote and am trying to
masage it for what I am doing (with some, but not total success).

Sub Mail_Every_Worksheet()
Dim sh As Worksheet
Dim wb As Workbook
Dim strdate As String
Application.ScreenUpdating = False
For Each sh In ThisWorkbook.Worksheets
If sh.Range("a1").Value Like "?*@?*.?*" Then
strdate = Format(Now, "dd-mm-yy h-mm-ss")
sh.Copy
Set wb = ActiveWorkbook
With wb
.SaveAs "Sheet " & sh.Name & " of " _
& ThisWorkbook.Name & " " & strdate & ".xls"
.SendMail ActiveSheet.Range("a1").Value, _
"NISR05" & " " & "-" & " " & sh.Range("b4")
.ChangeFileAccess xlReadOnly
Kill .FullName
.Close False
End With
End If
Next sh
Application.ScreenUpdating = True
End Sub

I do not want to specify the email address - I would like for the user to
type it in.

"Ron de Bruin" wrote:

Hi Cris
Do you use sendMail or Outlook code

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



"Chris Brown" <Chris wrote in message
...
I have set up a macro that emails a sheet and retains the name of the
workbook in the subject line when Outlook is opened. I would like for it to
retain the name of the workbook, but I want to add the data from a particular
cell to the subject line as well.

Subject line example: NISR05 - Plastic Cup

Where "NISR05" is the name of the workbook and "Plastic Cup" is the data
located in cell B4.

Any help would be greatly appreciated!









  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Emailing From Excel

Sorry - I figured it out right after I clicked Post.

Last question: How can I remove the Read Only command? If I delete the
line, the macro errors out.

"Ron de Bruin" wrote:

Replace the sendmail line in the code example you posted with the new line I posted

so replace

.SendMail ActiveSheet.Range("a1").Value, _
"NISR05" & " " & "-" & " " & sh.Range("b4")


for

..SendMail "", _
Left(ThisWorkbook.Name, Len(ThisWorkbook.Name) - 4) & " - " & sh.Range("b4").Value



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



"Chris Brown" wrote in message ...
I'm still learning the VBA side. How do I load the code you provided? I
know I still need the Sub and End Sub - I just don't know where to put
..SendMail "", _
Left(ThisWorkbook.Name, Len(ThisWorkbook.Name) - 4) & " - " &
sh.Range("b4").Value




"Ron de Bruin" wrote:

Hi Chris

Try this

..SendMail "", _
Left(ThisWorkbook.Name, Len(ThisWorkbook.Name) - 4) & " - " & sh.Range("b4").Value


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



"Chris Brown" wrote in message ...
I use sendMail. In fact, I found a macro that you wrote and am trying to
masage it for what I am doing (with some, but not total success).

Sub Mail_Every_Worksheet()
Dim sh As Worksheet
Dim wb As Workbook
Dim strdate As String
Application.ScreenUpdating = False
For Each sh In ThisWorkbook.Worksheets
If sh.Range("a1").Value Like "?*@?*.?*" Then
strdate = Format(Now, "dd-mm-yy h-mm-ss")
sh.Copy
Set wb = ActiveWorkbook
With wb
.SaveAs "Sheet " & sh.Name & " of " _
& ThisWorkbook.Name & " " & strdate & ".xls"
.SendMail ActiveSheet.Range("a1").Value, _
"NISR05" & " " & "-" & " " & sh.Range("b4")
.ChangeFileAccess xlReadOnly
Kill .FullName
.Close False
End With
End If
Next sh
Application.ScreenUpdating = True
End Sub

I do not want to specify the email address - I would like for the user to
type it in.

"Ron de Bruin" wrote:

Hi Cris
Do you use sendMail or Outlook code

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



"Chris Brown" <Chris wrote in message
...
I have set up a macro that emails a sheet and retains the name of the
workbook in the subject line when Outlook is opened. I would like for it to
retain the name of the workbook, but I want to add the data from a particular
cell to the subject line as well.

Subject line example: NISR05 - Plastic Cup

Where "NISR05" is the name of the workbook and "Plastic Cup" is the data
located in cell B4.

Any help would be greatly appreciated!










  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Emailing From Excel

Why ?

Do you want to keep the file you send

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



"Chris Brown" wrote in message ...
Sorry - I figured it out right after I clicked Post.

Last question: How can I remove the Read Only command? If I delete the
line, the macro errors out.

"Ron de Bruin" wrote:

Replace the sendmail line in the code example you posted with the new line I posted

so replace

.SendMail ActiveSheet.Range("a1").Value, _
"NISR05" & " " & "-" & " " & sh.Range("b4")


for

..SendMail "", _
Left(ThisWorkbook.Name, Len(ThisWorkbook.Name) - 4) & " - " & sh.Range("b4").Value



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



"Chris Brown" wrote in message ...
I'm still learning the VBA side. How do I load the code you provided? I
know I still need the Sub and End Sub - I just don't know where to put
..SendMail "", _
Left(ThisWorkbook.Name, Len(ThisWorkbook.Name) - 4) & " - " &
sh.Range("b4").Value




"Ron de Bruin" wrote:

Hi Chris

Try this

..SendMail "", _
Left(ThisWorkbook.Name, Len(ThisWorkbook.Name) - 4) & " - " & sh.Range("b4").Value


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



"Chris Brown" wrote in message
...
I use sendMail. In fact, I found a macro that you wrote and am trying to
masage it for what I am doing (with some, but not total success).

Sub Mail_Every_Worksheet()
Dim sh As Worksheet
Dim wb As Workbook
Dim strdate As String
Application.ScreenUpdating = False
For Each sh In ThisWorkbook.Worksheets
If sh.Range("a1").Value Like "?*@?*.?*" Then
strdate = Format(Now, "dd-mm-yy h-mm-ss")
sh.Copy
Set wb = ActiveWorkbook
With wb
.SaveAs "Sheet " & sh.Name & " of " _
& ThisWorkbook.Name & " " & strdate & ".xls"
.SendMail ActiveSheet.Range("a1").Value, _
"NISR05" & " " & "-" & " " & sh.Range("b4")
.ChangeFileAccess xlReadOnly
Kill .FullName
.Close False
End With
End If
Next sh
Application.ScreenUpdating = True
End Sub

I do not want to specify the email address - I would like for the user to
type it in.

"Ron de Bruin" wrote:

Hi Cris
Do you use sendMail or Outlook code

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



"Chris Brown" <Chris wrote in message
...
I have set up a macro that emails a sheet and retains the name of the
workbook in the subject line when Outlook is opened. I would like for it to
retain the name of the workbook, but I want to add the data from a particular
cell to the subject line as well.

Subject line example: NISR05 - Plastic Cup

Where "NISR05" is the name of the workbook and "Plastic Cup" is the data
located in cell B4.

Any help would be greatly appreciated!












  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Emailing From Excel

I use the sheet as an approval process where each person that receives the
file is able to approve with their name on an appropriate line and send to
the next. Security is not really an issue on this - it is really just a
means to eliminate paper. There is not a need to keep the file that is sent.
Users are able to access the sent file through Outlook.

"Ron de Bruin" wrote:

Why ?

Do you want to keep the file you send

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



"Chris Brown" wrote in message ...
Sorry - I figured it out right after I clicked Post.

Last question: How can I remove the Read Only command? If I delete the
line, the macro errors out.

"Ron de Bruin" wrote:

Replace the sendmail line in the code example you posted with the new line I posted

so replace

.SendMail ActiveSheet.Range("a1").Value, _
"NISR05" & " " & "-" & " " & sh.Range("b4")


for

..SendMail "", _
Left(ThisWorkbook.Name, Len(ThisWorkbook.Name) - 4) & " - " & sh.Range("b4").Value



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



"Chris Brown" wrote in message ...
I'm still learning the VBA side. How do I load the code you provided? I
know I still need the Sub and End Sub - I just don't know where to put
..SendMail "", _
Left(ThisWorkbook.Name, Len(ThisWorkbook.Name) - 4) & " - " &
sh.Range("b4").Value




"Ron de Bruin" wrote:

Hi Chris

Try this

..SendMail "", _
Left(ThisWorkbook.Name, Len(ThisWorkbook.Name) - 4) & " - " & sh.Range("b4").Value


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



"Chris Brown" wrote in message
...
I use sendMail. In fact, I found a macro that you wrote and am trying to
masage it for what I am doing (with some, but not total success).

Sub Mail_Every_Worksheet()
Dim sh As Worksheet
Dim wb As Workbook
Dim strdate As String
Application.ScreenUpdating = False
For Each sh In ThisWorkbook.Worksheets
If sh.Range("a1").Value Like "?*@?*.?*" Then
strdate = Format(Now, "dd-mm-yy h-mm-ss")
sh.Copy
Set wb = ActiveWorkbook
With wb
.SaveAs "Sheet " & sh.Name & " of " _
& ThisWorkbook.Name & " " & strdate & ".xls"
.SendMail ActiveSheet.Range("a1").Value, _
"NISR05" & " " & "-" & " " & sh.Range("b4")
.ChangeFileAccess xlReadOnly
Kill .FullName
.Close False
End With
End If
Next sh
Application.ScreenUpdating = True
End Sub

I do not want to specify the email address - I would like for the user to
type it in.

"Ron de Bruin" wrote:

Hi Cris
Do you use sendMail or Outlook code

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



"Chris Brown" <Chris wrote in message
...
I have set up a macro that emails a sheet and retains the name of the
workbook in the subject line when Outlook is opened. I would like for it to
retain the name of the workbook, but I want to add the data from a particular
cell to the subject line as well.

Subject line example: NISR05 - Plastic Cup

Where "NISR05" is the name of the workbook and "Plastic Cup" is the data
located in cell B4.

Any help would be greatly appreciated!













  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Emailing From Excel

You can't remove the Read Only command because it is used to delete
the activeworkbook (WB in the code) when it is open.

The file you send is not Read Only


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



"Chris Brown" wrote in message ...
I use the sheet as an approval process where each person that receives the
file is able to approve with their name on an appropriate line and send to
the next. Security is not really an issue on this - it is really just a
means to eliminate paper. There is not a need to keep the file that is sent.
Users are able to access the sent file through Outlook.

"Ron de Bruin" wrote:

Why ?

Do you want to keep the file you send

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



"Chris Brown" wrote in message ...
Sorry - I figured it out right after I clicked Post.

Last question: How can I remove the Read Only command? If I delete the
line, the macro errors out.

"Ron de Bruin" wrote:

Replace the sendmail line in the code example you posted with the new line I posted

so replace

.SendMail ActiveSheet.Range("a1").Value, _
"NISR05" & " " & "-" & " " & sh.Range("b4")


for

..SendMail "", _
Left(ThisWorkbook.Name, Len(ThisWorkbook.Name) - 4) & " - " & sh.Range("b4").Value



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



"Chris Brown" wrote in message
...
I'm still learning the VBA side. How do I load the code you provided? I
know I still need the Sub and End Sub - I just don't know where to put
..SendMail "", _
Left(ThisWorkbook.Name, Len(ThisWorkbook.Name) - 4) & " - " &
sh.Range("b4").Value




"Ron de Bruin" wrote:

Hi Chris

Try this

..SendMail "", _
Left(ThisWorkbook.Name, Len(ThisWorkbook.Name) - 4) & " - " & sh.Range("b4").Value


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



"Chris Brown" wrote in message
...
I use sendMail. In fact, I found a macro that you wrote and am trying to
masage it for what I am doing (with some, but not total success).

Sub Mail_Every_Worksheet()
Dim sh As Worksheet
Dim wb As Workbook
Dim strdate As String
Application.ScreenUpdating = False
For Each sh In ThisWorkbook.Worksheets
If sh.Range("a1").Value Like "?*@?*.?*" Then
strdate = Format(Now, "dd-mm-yy h-mm-ss")
sh.Copy
Set wb = ActiveWorkbook
With wb
.SaveAs "Sheet " & sh.Name & " of " _
& ThisWorkbook.Name & " " & strdate & ".xls"
.SendMail ActiveSheet.Range("a1").Value, _
"NISR05" & " " & "-" & " " & sh.Range("b4")
.ChangeFileAccess xlReadOnly
Kill .FullName
.Close False
End With
End If
Next sh
Application.ScreenUpdating = True
End Sub

I do not want to specify the email address - I would like for the user to
type it in.

"Ron de Bruin" wrote:

Hi Cris
Do you use sendMail or Outlook code

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



"Chris Brown" <Chris wrote in message
...
I have set up a macro that emails a sheet and retains the name of the
workbook in the subject line when Outlook is opened. I would like for it to
retain the name of the workbook, but I want to add the data from a particular
cell to the subject line as well.

Subject line example: NISR05 - Plastic Cup

Where "NISR05" is the name of the workbook and "Plastic Cup" is the data
located in cell B4.

Any help would be greatly appreciated!

















  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Emailing From Excel

I gotcha - you have been a tremendous help and I thank you for the time that
you have given me!


"Ron de Bruin" wrote:

You can't remove the Read Only command because it is used to delete
the activeworkbook (WB in the code) when it is open.

The file you send is not Read Only


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



"Chris Brown" wrote in message ...
I use the sheet as an approval process where each person that receives the
file is able to approve with their name on an appropriate line and send to
the next. Security is not really an issue on this - it is really just a
means to eliminate paper. There is not a need to keep the file that is sent.
Users are able to access the sent file through Outlook.

"Ron de Bruin" wrote:

Why ?

Do you want to keep the file you send

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



"Chris Brown" wrote in message ...
Sorry - I figured it out right after I clicked Post.

Last question: How can I remove the Read Only command? If I delete the
line, the macro errors out.

"Ron de Bruin" wrote:

Replace the sendmail line in the code example you posted with the new line I posted

so replace

.SendMail ActiveSheet.Range("a1").Value, _
"NISR05" & " " & "-" & " " & sh.Range("b4")


for

..SendMail "", _
Left(ThisWorkbook.Name, Len(ThisWorkbook.Name) - 4) & " - " & sh.Range("b4").Value



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



"Chris Brown" wrote in message
...
I'm still learning the VBA side. How do I load the code you provided? I
know I still need the Sub and End Sub - I just don't know where to put
..SendMail "", _
Left(ThisWorkbook.Name, Len(ThisWorkbook.Name) - 4) & " - " &
sh.Range("b4").Value




"Ron de Bruin" wrote:

Hi Chris

Try this

..SendMail "", _
Left(ThisWorkbook.Name, Len(ThisWorkbook.Name) - 4) & " - " & sh.Range("b4").Value


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



"Chris Brown" wrote in message
...
I use sendMail. In fact, I found a macro that you wrote and am trying to
masage it for what I am doing (with some, but not total success).

Sub Mail_Every_Worksheet()
Dim sh As Worksheet
Dim wb As Workbook
Dim strdate As String
Application.ScreenUpdating = False
For Each sh In ThisWorkbook.Worksheets
If sh.Range("a1").Value Like "?*@?*.?*" Then
strdate = Format(Now, "dd-mm-yy h-mm-ss")
sh.Copy
Set wb = ActiveWorkbook
With wb
.SaveAs "Sheet " & sh.Name & " of " _
& ThisWorkbook.Name & " " & strdate & ".xls"
.SendMail ActiveSheet.Range("a1").Value, _
"NISR05" & " " & "-" & " " & sh.Range("b4")
.ChangeFileAccess xlReadOnly
Kill .FullName
.Close False
End With
End If
Next sh
Application.ScreenUpdating = True
End Sub

I do not want to specify the email address - I would like for the user to
type it in.

"Ron de Bruin" wrote:

Hi Cris
Do you use sendMail or Outlook code

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



"Chris Brown" <Chris wrote in message
...
I have set up a macro that emails a sheet and retains the name of the
workbook in the subject line when Outlook is opened. I would like for it to
retain the name of the workbook, but I want to add the data from a particular
cell to the subject line as well.

Subject line example: NISR05 - Plastic Cup

Where "NISR05" is the name of the workbook and "Plastic Cup" is the data
located in cell B4.

Any help would be greatly appreciated!
















  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Emailing From Excel

You are welcome

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



"Chris Brown" wrote in message ...
I gotcha - you have been a tremendous help and I thank you for the time that
you have given me!


"Ron de Bruin" wrote:

You can't remove the Read Only command because it is used to delete
the activeworkbook (WB in the code) when it is open.

The file you send is not Read Only


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



"Chris Brown" wrote in message ...
I use the sheet as an approval process where each person that receives the
file is able to approve with their name on an appropriate line and send to
the next. Security is not really an issue on this - it is really just a
means to eliminate paper. There is not a need to keep the file that is sent.
Users are able to access the sent file through Outlook.

"Ron de Bruin" wrote:

Why ?

Do you want to keep the file you send

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



"Chris Brown" wrote in message
...
Sorry - I figured it out right after I clicked Post.

Last question: How can I remove the Read Only command? If I delete the
line, the macro errors out.

"Ron de Bruin" wrote:

Replace the sendmail line in the code example you posted with the new line I posted

so replace

.SendMail ActiveSheet.Range("a1").Value, _
"NISR05" & " " & "-" & " " & sh.Range("b4")


for

..SendMail "", _
Left(ThisWorkbook.Name, Len(ThisWorkbook.Name) - 4) & " - " & sh.Range("b4").Value



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



"Chris Brown" wrote in message
...
I'm still learning the VBA side. How do I load the code you provided? I
know I still need the Sub and End Sub - I just don't know where to put
..SendMail "", _
Left(ThisWorkbook.Name, Len(ThisWorkbook.Name) - 4) & " - " &
sh.Range("b4").Value




"Ron de Bruin" wrote:

Hi Chris

Try this

..SendMail "", _
Left(ThisWorkbook.Name, Len(ThisWorkbook.Name) - 4) & " - " & sh.Range("b4").Value


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



"Chris Brown" wrote in message
...
I use sendMail. In fact, I found a macro that you wrote and am trying to
masage it for what I am doing (with some, but not total success).

Sub Mail_Every_Worksheet()
Dim sh As Worksheet
Dim wb As Workbook
Dim strdate As String
Application.ScreenUpdating = False
For Each sh In ThisWorkbook.Worksheets
If sh.Range("a1").Value Like "?*@?*.?*" Then
strdate = Format(Now, "dd-mm-yy h-mm-ss")
sh.Copy
Set wb = ActiveWorkbook
With wb
.SaveAs "Sheet " & sh.Name & " of " _
& ThisWorkbook.Name & " " & strdate & ".xls"
.SendMail ActiveSheet.Range("a1").Value, _
"NISR05" & " " & "-" & " " & sh.Range("b4")
.ChangeFileAccess xlReadOnly
Kill .FullName
.Close False
End With
End If
Next sh
Application.ScreenUpdating = True
End Sub

I do not want to specify the email address - I would like for the user to
type it in.

"Ron de Bruin" wrote:

Hi Cris
Do you use sendMail or Outlook code

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



"Chris Brown" <Chris wrote in message
...
I have set up a macro that emails a sheet and retains the name of the
workbook in the subject line when Outlook is opened. I would like for it to
retain the name of the workbook, but I want to add the data from a particular
cell to the subject line as well.

Subject line example: NISR05 - Plastic Cup

Where "NISR05" is the name of the workbook and "Plastic Cup" is the data
located in cell B4.

Any help would be greatly appreciated!


















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
emailing from Excel Roger Excel Discussion (Misc queries) 0 July 2nd 07 07:14 PM
Emailing Excel? JoeBed Excel Discussion (Misc queries) 2 May 5th 06 09:16 PM
Emailing Excel lsmft Excel Discussion (Misc queries) 4 March 17th 06 11:59 AM
emailing from excel selkov Excel Programming 1 February 11th 04 08:56 AM
Emailing from Excel pvp Excel Programming 1 August 4th 03 02:34 PM


All times are GMT +1. The time now is 04:42 AM.

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"