ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] Àɮפ¤ªº¨â­ÓSheet ½Æ»s¨ì·sªºÀÉ®×°ÝÃD

¦^´_  GBKEE

Àˬd¤@¤U¤u§@ªíªº¦WºÙ "TEST", "RAW", "TODAY","YESDAY","NOW"¬O§_¦³»~!
¦³"TEST "," TES ...
jackyliu µoªí©ó 2013-8-28 14:47
  1. Sub Copy_Sheet()
  2.     Sheets(Array("TEST", "RAW", "TODAY", "YESDAY", "NOW")).Copy   '  ¦P®É½Æ»s "TEST"¡B¥H¤Î "RAW" µ¥¤­­Ó¤u§@ªí³æ
  3.     fs = ThisWorkbook.Path & "\" & Format(Date, "yyyy_mm_dd") & ".xls"      '  ¦sÀÉÀɦW
  4.     ActiveWorkbook.SaveAs FileName:=fs, FileFormat:=-4143
  5. End Sub
½Æ»s¥N½X
³o»yªk¬O¥¿½Tªº¡AGBKEEª©¤j¥Îªº¬O 2003¡A¦Ó§Ú¬O¨Ï¥Î 2010¡A
½ÐÀˬd©pªºµ{¦¡½X¡C

TOP

¦^´_  GBKEE
¦^ÂÐGBKEE: ­«·s¦bÀˬd´ú¸Õ¨ä¥LÀÉ®×,³£¤£¦æ½Æ»s¤T­Ó¥H¤Wªºsheet!  Sheets(Array("TEST", "RA ...
jackyliu µoªí©ó 2013-8-28 15:30

ªþ¤WÀɮסA½Ð°Ñ¦Ò¡G
¼Ï¯Ã¾ã²z§¹²¦«á½Æ»s¨ì·sªºÀÉ®×°ÝÃD.rar (20.46 KB)

TOP

¦^´_ 12# jackyliu
¦³Ãö Send Mail Using CDO¡A§Ú±q°ê¥~ºô¯¸ºK¿ý¤F¤@½g¡A½Ð°Ñ¦Ò¡G
  1. ' Send Mail Using CDO
  2. Public Sub testCDO()
  3. '  Purpose   Demondtrate Sending an Email with an attachment using CDO (Collaboration Data Objects)
  4. '           Uses Late Binding - Does not need a reference to the Microsoft CDO For Windows library
  5. '           cdosys comes innstalled as standard on Windows 2K and higher workstations and servers
  6. '           This code will fail on NT4, Win 98, and Win 95 where the cdosys.dll is not present
  7. '  Author    Ron Weiner    [email protected]
  8. '           Copyrite © 2004-2005 WorksRite Software Solutions
  9. '           You may use this code example for any purpose what-so-ever with
  10. '           acknowledgement. However, you may not publish the code without
  11. '           the express, written permission of the author.
  12.     Const cdoSendUsingPort = 2
  13.     Const cdoBasic = 1
  14.     Dim objCDOConfig As Object, objCDOMessage As Object
  15.     Dim strSch As String

  16.     strSch = "http://schemas.microsoft.com/cdo/configuration/"
  17.     Set objCDOConfig = CreateObject("CDO.Configuration")
  18.     With objCDOConfig.Fields
  19.         .Item(strSch & "sendusing") = cdoSendUsingPort
  20.         .Item(strSch & "smtpserver") = "SMTP.ServerName.Com"
  21.         ' Only used if SMTP server requires Authentication
  22.         .Item(strSch & "smtpauthenticate") = cdoBasic
  23.         .Item(strSch & "sendusername") = "[email protected]"
  24.         .Item(strSch & "sendpassword") = "YourPassword"
  25.         .Update
  26.     End With

  27.     Set objCDOMessage = CreateObject("CDO.Message")
  28.     With objCDOMessage
  29.         Set .Configuration = objCDOConfig
  30.         .from = "Senders Pretty Name"
  31.         .sender = "[email protected]"
  32.         .To = "[email protected]"
  33.         .Subject = "Sample CDO Message"
  34.         ' Use TextBody to send Email in Plain Text Format
  35.         '.TextBody = "This is a test for CDO message"
  36.         ' Use HTMLBody to send Email in Rich Text (HTML) Format
  37.         .HTMLBody = "Test CDO Rich Text this is not Bold But <B>This is!</B>"
  38.         ' Adding Attachments is easy enough
  39.         .AddAttachment "c:\SomeFile.zip"
  40.         .AddAttachment "c:\SomeOtherFile.pdf"
  41.         ' Un-Rem next line to get "Return Reciept Request"
  42.         '.MDNRequested = True
  43.         .Send
  44.     End With
  45.     Set objCDOMessage = Nothing
  46.     Set objCDOConfig = Nothing
  47. End Sub
½Æ»s¥N½X

TOP

¦^´_ 14# jackyliu
³o¬O©p©Ò­nªº¶Ü¡H
  1. Sub Ex()
  2.     Dim fs As String
  3.    
  4.     fs = ThisWorkbook.Path & "\" & Format(Now, "yyyy_mm_dd hhmm") & ".xls"  
  5.     sendmail(fs)
  6. End Sub

  7. Sub sendmail(fs As String)
  8.    CDO_Mail_Object.AddAttachment fs
  9.     CDO_Mail_Object.Send
  10. End Sub
½Æ»s¥N½X

TOP

¦^´_ 14# jackyliu
¦]¬°µLªk±o¨ì SMTP Server ªº¦ì§}¡A§Ú§â°õ¦æµ²ªG¦C¥Ü¦p¤U¡C
¤§«e©p¬O¦p¦ó¶Ç°e¥X¥h¡H¯à§_§â­ì½Z¤W¶Ç´£¨Ñ¹ê°ÈÀ³¥Î¡C

¼Ï¯Ã¾ã²z§¹²¦«á½Æ»s¨ì·sªºÀÉ®×°ÝÃD.rar (24.06 KB)

TOP

¦^´_ 14# jackyliu
¦A­×¥¿«á³sµ²²£¥Íªº°T®§¡G(¤w¸g¥[¤JcdoSendUsingPort µ¥°Ñ¼Æ)
ÃöÁä©ÊÀ³¬OµLªk¥¿½T³sµ² SMTP Server¡C
  1. Sub sendEMail(fd As String)
  2.     Const cdoSendUsingPort = 2
  3.     Const cdoBasic = 1
  4.     Dim objEmail As Object, CDO_Config As Object
  5.     Dim SMTP_Config As Variant
  6.     Dim strSch As String

  7.     strSch = "http://schemas.microsoft.com/cdo/configuration/"
  8.     Set objEmail = CreateObject("CDO.Message")       '  «Ø¥ß CDO ª«¥ó
  9.    
  10.     On Error GoTo debugErr
  11.     Set CDO_Config = CreateObject("CDO.Configuration")
  12.     With CDO_Config.Fields
  13.         .Item(strSch & "sendusing") = cdoSendUsingPort
  14.         .Item(strSch & "smtpserver") = "SMTP.ServerName.Com"
  15.         ' Only used if SMTP server requires Authentication
  16.         .Item(strSch & "smtpauthenticate") = cdoBasic
  17.         .Item(strSch & "sendusername") = "[email protected]"
  18.         .Item(strSch & "sendpassword") = ""
  19.         .Update
  20.     End With

  21.     With objEmail
  22.         Set .Configuration = CDO_Config

  23.         .From = "[email protected]"               '  ±H¥óªÌ¡]ºô°ì¥²¶·¦s¦b¡^
  24.         .To = "[email protected]"                 '  ¦¬¥óªÌ
  25.         .Subject = "CDO¶l¥ó´ú¸Õ"                    '  ¶l¥ó¥D¦®
  26.         .TextBody = "¶l¥ó´ú¸Õ¥»¤å"                 '  ¶l¥ó¤º¤å
  27.    
  28.         .AddAttachment fd
  29.         .Send
  30.     End With
  31.    
  32. debugErr:
  33.     If Err.Description <> "" Then MsgBox Err.Description
  34.     Set objEmail = Nothing
  35.     Set CDO_Config = Nothing
  36. End Sub
½Æ»s¥N½X

TOP

¦^´_ 18# jackyliu
©pªº SMTP Server ªº IP Address ¬O³]©w¦h¤Ö¡H

TOP

        ÀR«ä¦Û¦b : ¨C¤ÑµL©Ò¨Æ¨Æ¡A¬O¤H¥Íªº®ø¶OªÌ¡A¿n·¥¡B¦³¥Î¤~¬O¤H¥Íªº³Ð³yªÌ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD