LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 96
Default Place code from current workbook to new workbook

I am using the following code to create a new workbook and send via outlook
to whatever adress the user enters.

Private Sub Send1_Click()
Dim strdate As String
Sheets(Array("Emp24", "Main")).Copy
strdate = Format(Date, "dd-mm-yy") & " " & Format(Time, "h-mm-ss")
Worksheets("Emp24").Name = "NewData"
ActiveWorkbook.SaveAs "NewEmployeeData.xls"
ActiveWorkbook.SendMail "", _
"Employee Attendance Data"
ActiveWorkbook.ChangeFileAccess xlReadOnly
Kill ActiveWorkbook.FullName
ActiveWorkbook.Close False
End Sub

In the original workbook inside the This Workbook section I have the
following:

Private Sub Workbook_Open

Dim lngColor As Long
lngColor = RGB(221, 221, 221)
ActiveWorkbook.Colors(16) = lngColor

End Sub

How can I place this 2nd code into the This Workbook section of the file
being sent i the first sub?

Thank You for any help.

 
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
copy and paste using code from workbook to workbook bigdaddy3 Excel Discussion (Misc queries) 2 September 14th 05 11:06 AM
Close a the current workbook and load another specified workbook Adrian[_7_] Excel Programming 4 August 7th 04 05:29 PM
Copy a range of cells in an unopened workbook and paste it to the current workbook topstar Excel Programming 3 June 24th 04 12:50 PM
Place code in a new workbook with a macro. help_wanted Excel Programming 1 April 1st 04 04:51 PM
Transparently updating another workbook from the current workbook lothario[_40_] Excel Programming 3 November 2nd 03 01:58 AM


All times are GMT +1. The time now is 06:07 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"