Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Sheet Name???

I have a macro that emails the ActiveSheet to people in a certain range on
another sheet. The sheet being emailed has a code to name the sheet the value
of cell A3. The sheet is copied into another workbook before it emails. Is
there a way to have the code to name the sheet deleted and the sheet be named
what it is when copied? I dont want anyone to be able to accidentally
change the sheet name when they receive it.

The code I use is:

Sub Mail_Report()
Dim wb As Workbook
Dim strdate As String
strdate = Format(Now, "dd-mm-yy h-mm-ss")
Application.ScreenUpdating = False
ActiveSheet.Copy
Application.CutCopyMode = False
Set wb = ActiveWorkbook
With wb
.SaveAs ActiveSheet.Name
Dim MyArr As Variant
MyArr = ThisWorkbook.Sheets("Email").Range("b16:b31")
.SendMail MyArr, ActiveSheet.Name & " " & "2005" & " " & "-" & " " &
"Offshore P&A Activity Report" & " " & "****CONFIDENTIAL****"
.ChangeFileAccess xlReadOnly
Kill .FullName
.Close False
End With
Application.ScreenUpdating = True
End Sub



Thanks,
Chance

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Sheet Name???

Chance,

This will delete the code in Sheet2 class module

Dim VBComp As Object

Set VBComp = ThisWorkbook.VBProject.vbcomponents("Sheet2").code module
VBComp.DeleteLines 1, VBComp.CountOfLines

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Chance224" wrote in message
...
I have a macro that emails the ActiveSheet to people in a certain range on
another sheet. The sheet being emailed has a code to name the sheet the

value
of cell A3. The sheet is copied into another workbook before it emails.

Is
there a way to have the code to name the sheet deleted and the sheet be

named
what it is when copied? I don't want anyone to be able to accidentally
change the sheet name when they receive it.

The code I use is:

Sub Mail_Report()
Dim wb As Workbook
Dim strdate As String
strdate = Format(Now, "dd-mm-yy h-mm-ss")
Application.ScreenUpdating = False
ActiveSheet.Copy
Application.CutCopyMode = False
Set wb = ActiveWorkbook
With wb
.SaveAs ActiveSheet.Name
Dim MyArr As Variant
MyArr = ThisWorkbook.Sheets("Email").Range("b16:b31")
.SendMail MyArr, ActiveSheet.Name & " " & "2005" & " " & "-" & " "

&
"Offshore P&A Activity Report" & " " & "****CONFIDENTIAL****"
.ChangeFileAccess xlReadOnly
Kill .FullName
.Close False
End With
Application.ScreenUpdating = True
End Sub



Thanks,
Chance



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Sheet Name???

Thanks for the help, but Im not sure where I need to insert the code. The
sheet that is emailed is copied from the previous day. This report is done
daily so the sheet name always changes.

Chance

"Bob Phillips" wrote:

Chance,

This will delete the code in Sheet2 class module

Dim VBComp As Object

Set VBComp = ThisWorkbook.VBProject.vbcomponents("Sheet2").code module
VBComp.DeleteLines 1, VBComp.CountOfLines

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Chance224" wrote in message
...
I have a macro that emails the ActiveSheet to people in a certain range on
another sheet. The sheet being emailed has a code to name the sheet the

value
of cell A3. The sheet is copied into another workbook before it emails.

Is
there a way to have the code to name the sheet deleted and the sheet be

named
what it is when copied? I don't want anyone to be able to accidentally
change the sheet name when they receive it.

The code I use is:

Sub Mail_Report()
Dim wb As Workbook
Dim strdate As String
strdate = Format(Now, "dd-mm-yy h-mm-ss")
Application.ScreenUpdating = False
ActiveSheet.Copy
Application.CutCopyMode = False
Set wb = ActiveWorkbook
With wb
.SaveAs ActiveSheet.Name
Dim MyArr As Variant
MyArr = ThisWorkbook.Sheets("Email").Range("b16:b31")
.SendMail MyArr, ActiveSheet.Name & " " & "2005" & " " & "-" & " "

&
"Offshore P&A Activity Report" & " " & "****CONFIDENTIAL****"
.ChangeFileAccess xlReadOnly
Kill .FullName
.Close False
End With
Application.ScreenUpdating = True
End Sub



Thanks,
Chance




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Sheet Name???

I would put it in a standard code module in your Personal.xls workbook, and
assign it to a toolbar button.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Chance224" wrote in message
...
Thanks for the help, but I'm not sure where I need to insert the code.

The
sheet that is emailed is copied from the previous day. This report is

done
daily so the sheet name always changes.

Chance

"Bob Phillips" wrote:

Chance,

This will delete the code in Sheet2 class module

Dim VBComp As Object

Set VBComp =

ThisWorkbook.VBProject.vbcomponents("Sheet2").code module
VBComp.DeleteLines 1, VBComp.CountOfLines

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Chance224" wrote in message
...
I have a macro that emails the ActiveSheet to people in a certain

range on
another sheet. The sheet being emailed has a code to name the sheet

the
value
of cell A3. The sheet is copied into another workbook before it

emails.
Is
there a way to have the code to name the sheet deleted and the sheet

be
named
what it is when copied? I don't want anyone to be able to

accidentally
change the sheet name when they receive it.

The code I use is:

Sub Mail_Report()
Dim wb As Workbook
Dim strdate As String
strdate = Format(Now, "dd-mm-yy h-mm-ss")
Application.ScreenUpdating = False
ActiveSheet.Copy
Application.CutCopyMode = False
Set wb = ActiveWorkbook
With wb
.SaveAs ActiveSheet.Name
Dim MyArr As Variant
MyArr = ThisWorkbook.Sheets("Email").Range("b16:b31")
.SendMail MyArr, ActiveSheet.Name & " " & "2005" & " " & "-" &

" "
&
"Offshore P&A Activity Report" & " " & "****CONFIDENTIAL****"
.ChangeFileAccess xlReadOnly
Kill .FullName
.Close False
End With
Application.ScreenUpdating = True
End Sub



Thanks,
Chance






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
excel sheet bootom half sheet goes behind top part of sheet rob Excel Worksheet Functions 2 January 17th 09 01:28 AM
Duplicate sheet, autonumber sheet, record data on another sheet des-sa[_2_] Excel Worksheet Functions 0 May 8th 08 06:56 PM
How do I select price from sheet.b where sheet.a part no = sheet.b Sonny Excel Worksheet Functions 4 April 4th 06 05:08 PM
relative sheet references ala sheet(-1)!B11 so I can copy a sheet. RonMc5 Excel Discussion (Misc queries) 9 February 3rd 05 12:51 AM
Inserting a row in sheet A should Insert a row in sheet B, removing a row in Sheet A should remove the corresponding row in sheet B Hannes Heckner Excel Programming 1 March 5th 04 09:10 AM


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