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

¦p¦óÅý ¡yª`·N¡I¤é´Á¤ñ¹ï¤£¤@¼Ë¡I¡z ªº¼u¥Xµøµ¡¯àÀu¥ýÅã¥Ü©O?

¦p¦óÅý ¡yª`·N¡I¤é´Á¤ñ¹ï¤£¤@¼Ë¡I¡z ªº¼u¥Xµøµ¡¯àÀu¥ýÅã¥Ü©O?

¥»©«³Ì«á¥Ñ RCRG ©ó 2015-11-18 05:22 ½s¿è

¸ÑÃD¸ê®Æ§¨.rar (6.15 KB)

¤U¸ü¸ê®Æ§¨«á¡A·|¦³¤T­ÓÀɮסA¦Ó¥D­n°ÝÃD´y­z¦b¥DÀÉ¡A¨ä¥L¨â­Ó ¸ê®ÆÀÉ©M¤é´Á¤ñ¹ïÀÉ ¥u¬O¤ñ¹ï°Ñ·Ó¥Î¡A¥i¤£¶}¡B¤£²z·|¤§¡C

¥»©«³Ì«á¥Ñ GBKEE ©ó 2015-11-21 14:10 ½s¿è

¦^´_ 1# RCRG
  1. Option Explicit
  2. Private Sub Workbook_Open()
  3.      ÀË´ú¸ê®ÆÀÉ
  4.      X.Quit
  5.      If xMsg = "" Then GoTo 999 '­Y¤w¶}©ñŪ¨ú¡Aª½±µ¸õ¦Ü¡e´£¥Ü¤å¦r¡f
  6.     MsgBox xMsg & Chr(10) & Chr(10) & _
  7.     "¦b³øªí­«·s¶}©ñÅv­­«e¡A¥»ÀÉ®×±N¦Û°ÊÃö³¬¡A¡@ " & Chr(10) & Chr(10) & _
  8.     "¡¯¡¯¡¯­Y¦³ºÃ°Ý¡A½Ð¬¢ÀÉ®×µ{¦¡ºÞ²z¤H¡¯¡¯¡¯"
  9.     Application.DisplayAlerts = False
  10.     If Workbooks.Count = 1 Then
  11.         Application.Quit
  12.     Else
  13.         ThisWorkbook.Close 0
  14.     End If
  15.     Application.DisplayAlerts = True
  16.     Exit Sub
  17. 999:
  18.     If Sheet1.[a1] <> Str Then MsgBox "ª`·N¡I¤é´Á¤ñ¹ï¤£¤@¼Ë¡I", 48  '³o¼ËÀu¥ý¹ï¶Ü?        
  19.     If Info2 <> "" Then MsgBox Info2   
  20.     Worksheets("TEST").Protect Password:="123", userInterFaceonly:=True
  21.     Worksheets("TEST").EnableAutoFilter = True
  22. End Sub
½Æ»s¥N½X
  1. Option Explicit
  2. Public xMsg$, Info1$, Info2$       '-------------------------------------------
  3. Public Str$, X As New Application '-------------------------------------------
  4. Sub ÀË´ú¸ê®ÆÀÉ()
  5.     Dim XB As Workbook, XSHT As Worksheet, DataFile As String
  6.     DataFile = ThisWorkbook.Path & "\¸ê®ÆÀÉ.xls" '¡]ª`·N¡^¥¿¦¡¨Ï¥Î®É¡A§ó§ï¬°¹ê»Ú©T©wªº¡e¸ô®|+ÀɦW¡f
  7.     xMsg = "": Info1 = "": Info2 = ""
  8.     If Dir(DataFile) = "" Then xMsg = "§ä¤£¨ìÀɮסA©Î¨S¦³Åv­­Åª¨ú¡I¡@ ": Exit Sub
  9.     Set XB = X.Workbooks.Open(DataFile, ReadOnly:=True)
  10.     On Error Resume Next
  11.     Set XSHT = XB.Sheets("Åv­­³]©w")
  12.     If XSHT Is Nothing Then
  13.         xMsg = "°»´ú¿ù»~¡GDATA¸ê®ÆÀÉ¡eÅv­­³]©w¡f¤u§@ªí¤£¦s¦b¡I¡@ "
  14.         Exit Sub
  15.     End If
  16.     Info1 = XSHT.Range("C2").Value 'Åv­­³]©w­È
  17.     Info2 = XSHT.Range("C4").Value '¶}±ÒÀɮ׮ɪº´£¥Ü¤å¦r
  18.     ''''''''''''''''''''''''''''''''''''''''''''''''
  19.     DataFile = ThisWorkbook.Path & "\¤é´Á¤ñ¹ïÀÉ.xls"
  20.     Str = X.Workbooks.Open(DataFile, ReadOnly:=True).Sheets("¤u§@ªíA").[a1]
  21.     '''''''''''''''''''''''''''''''''''''''''''''''''
  22.     If Info1 = "OFF" Then xMsg = "¥Ø«e¸T¤î¨Ï¥Î¡I ": Exit Sub
  23.     If Info1 = "Update" Then xMsg = "¤w§ó·s¡AÂÂÀɤ£¯à¦A¨Ï¥Î¡A½Ð­«·s¤U¸ü¡I¡@": Exit Sub
  24. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 2# GBKEE


    ½Ð°ÝGBKEE¤j¡A§Ú¶K¤W±zªºVBA¨Ï¥Î«á¡Aµo²{¥u·|¶]¥X"ª`·N¡I¤é´Á¤ñ¹ï¤£¤@¼Ë¡I"ªº¼u¥Xµøµ¡¡A¸ê®ÆÀɪºC4Äæ¦ì¼u¥Xµøµ¡¤Ï¦Ó¤£·|Åã¥Ü¤F¡A¬O§Ú­þ¸Ì¥Î¿ù¤F¶Ü?
¦]¬°§Úªº»Ý¨D¬O¥u·Q§â "ª`·N¡I¤é´Á¤ñ¹ï¤£¤@¼Ë¡I" ¼u¥Xµøµ¡¯àÀu¥ýÅã¥Ü¡A¦ý¤£²§°Ê¨ì§Ú­ì¥»VBAªº¥\¯à¡A¦pªG·|¼vÅT¨ì§Ú¥»¨ÓªºVBA®ÄªG¡A¨º³o¼Ë´N¦]¤p¥¢¤j¤F..QQ

TOP

¦^´_ 2# GBKEE


   µ²ªG½×ªº¸Ü¡A³o¼Ëªº½T¬O§Ú­nªº¡F

¤£¹L¡A§Ú­ì¥»This Workbook¤º "¤é´Á¤ñ¹ïÀÉ"ªº¸ô®|«ç¤£¨£¤F¡IQQ

¦]¬°¥L­Ì¬O¦³Ãö³s©Êªº¡A¦pªG "¥DÀÉ" ©M "¤é´Á¤ñ¹ïÀÉ" A1Ä檺¤é´Á¤£¤@¼Ë´N·|¼u¥Xµøµ¡¨Ó´£¿ô¨Ï¥ÎªÌ¡A¦ý¦pªG¤é´Á¬O¤@¼Ëªº´N¤£·|¼u¥Xµøµ¡¡F
¤£ª¾¬O§_¯àÀ°§Ú§â¸ô®|¥[¦^¥h©O? ¦³³ÒGBKEE¤j¤F¡IÁÂÁ¡I

TOP

¦^´_ 4# RCRG

¦Û¤v­×§ï¸Õ¸Õ¬Ý
  1. Info1 = XSHT.Range("C2").Value 'Åv­­³]©w­È
  2.     Info2 = XSHT.Range("C4").Value '¶}±ÒÀɮ׮ɪº´£¥Ü¤å¦r
  3.     ''''''''''''''''''''''''''''''''''''''''''''''''
  4.     'DataFile = ThisWorkbook.Path & "\¤é´Á¤ñ¹ïÀÉ.xls"
  5.     DataFile = "D:\Documents and Settings\®à­±\¸ÑÃD¸ê®Æ§¨\¤é´Á¤ñ¹ïÀÉ.xls"
  6.    
  7.     Str = X.Workbooks.Open(DataFile, ReadOnly:=True).Sheets("¤u§@ªíA").[a1]
  8.     '''''''''''''''''''''''''''''''''''''''''''''''''
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 5# GBKEE


    ®@®@¡I©Ò¥H¬O¦³"¤é´Á¤ñ¹ïÀÉ"ªº¸ô®|¹ï§a¡A¬O§Ú¦Û¤v¨S¬Ý¨ìÅo¡I
¨þ¨þ ¡I¤£¦n·N«ä¡AGBKEE¤j¡A²{¦b§Ú¦A©Ô¦^¥h¬ÝÁÙ¯uªº¦³"¤é´Á¤ñ¹ïÀÉ"ªº¸ô®|©O¡I

TOP

        ÀR«ä¦Û¦b : ¤f»¡¦n¸Ü¡B¤ß·Q¦n·N¡B¨­¦æ¦n¨Æ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD