设置单元格背景色
Sub sbPrintColorIndexColors() Dim iCntr For iCntr = 1 To 56 Cells(iCntr, 1).Interior.ColorIndex = iCntr Cells(iCntr, 1) = iCntr Next iCntr End Sub
发送邮件
Public Sub SendEmail() 'Declaration Dim oOApp As Object Dim oMail As Object Set oOApp = CreateObject("Outlook.Application") Set oMail = oOApp.CreateItem(0) On Error Resume Next ' Change the mail address and subject in the macro before you run it. With oMail .To = "marvin.xx@xxx.com" .CC = "" .BCC = "" .Subject = "Write Your Subject Here" .Body = "Hi, This is example Body Text." '.Attachments.Add ("C:\Temp\ExampleFile.xls") '=> To add any Attcahment .Display '=> It will display the message .Send '=> It will send the mail End With On Error GoTo 0 Set oMail = Nothing Set oOApp = Nothing End Sub
打开excel,默认打开userForm