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

[µo°Ý] ³Â·Ð¦U¦ì°ª¤â¬Ý¤@¤U ¦³Ãö³]©w¯S©w¹q¸£¶}±ÒVBAªº°ÝÃD

[µo°Ý] ³Â·Ð¦U¦ì°ª¤â¬Ý¤@¤U ¦³Ãö³]©w¯S©w¹q¸£¶}±ÒVBAªº°ÝÃD

  1. Private Sub Workbook_Open()
  2. sfolda = "D:\"
  3. '³o¬O³]©wÀÉ®×·j´Mªº¥Ø¿ý¬°D:\  ¥i¦Û¦æ³]©w
  4. sname = "test.TXT"
  5. '³]©w§ä¤@­Ó¦W¬°TEST.TXTªºÀÉ®×
  6. '½Ð¦Û¦æ§ó§ïÀɦW©ÎÀÉ®×Ãþ«¬,³Ì¦n¬O¯S§O¤@ÂI
  7. With Application.FileSearch
  8. .LookIn = sfolda
  9. .Filename = sname
  10. rsl = .Execute
  11. ' rsl¬O§ä¨ìªºÀɮ׼ƶq
  12. If rsl < 1 Then
  13. '¦pªG§ä¤£¨ìÀÉ®×rsl´N·|µ¥©ó0,«h°õ¦æ¤U­±µ{¦¡
  14. MsgBox "½Ð¦b«ü©w¹q¸£§@·~¡A¤~¯à¶}±ÒÀÉ®×", vbOKOnly
  15. '´£¥Ü¨Ï¥ÎªÌ¦b«ü©w¹q¸£§@·~¤~¯à¶}±Ò
  16. ActiveWorkbook.Close SaveChanges:=False
  17. 'ª½±µÃö³¬ÀÉ®×
  18. End If
  19. End With
  20. ActiveSheet.Unprotect Password = "ABCD"
  21. '³o¬O¸Ñ°£¤u§@ªí±K½X
  22. End Sub
½Æ»s¥N½X
¥H¤W¬O§Ú¦bºô¸ô¤W§ä¨ì¥i³]©w¯S©w¹q¸£¶}±Òªºµ{¦¡½X
¥u¤£¹L..·í§Ú°õ¦æ®É «oµo¥Í¤F¥H¤U±¡ªp

¤£ª¾¹D¬O¤£¬O§ÚÁÙ¦³¤°»ò¨S³]©w¨ì ÁÙ¬O¦¹µ{¦¡½X¥»´N¦³¯Ê³´¦Ó¤£¥i°õ¦æ

¦A³Â·Ð¦U¸ô°ª¤âªº«ü±Ð ÁÂÁÂ

TOP

·PÁÂo¤jªº¦^ÂÐ
¬O§Úªº¯à¤O¤Ó®t¤F
§Ú¬Ý¤F±z¶Kªººô¯¸©Ò±Ô­zªºWith Application.FileSearch³o®ø¥¢«á¥Îdir´À¥N
¨º·N«ä¬O §Ú¥u­n±NWith Application.FileSearch¦r¦ê§ï¦¨dir´N¦n¶Ü ÁÙ¬O­n«ç»ò¼g
ÁÂÁ«ü±Ð

TOP

Private Sub Workbook_Open()
mypath = "d:\"
myfile = Dir(mypath & "test.TXT")
Execute
If Execute < 1 Then
MsgBox "½Ð¦b«ü©w¹q¸£§@·~¡A¤~¯à¶}±ÒÀÉ®×", vbOKOnly
ActiveWorkbook.Close SaveChanges:=False
End If
End Sub

§Ú¥Î§Ú²z¸Ñªº¯à¤O§ï¤F³o­Ó,¦n¹³ÁÙ¬O¯Ê±ø¥ó,ÁÙ¬OµLªk¹B§@

TOP

¦^´_ 4# e19821223
  1. Option Explicit
  2. Private Sub Workbook_Open()
  3.     Dim mypath As String, myfile As String
  4.     mypath = "d:\"
  5.     myfile = Dir(mypath & "test.TXT")
  6.     If myfile = "" Then
  7.         MsgBox "½Ð¦b«ü©w¹q¸£§@·~¡A¤~¯à¶}±ÒÀÉ®×", vbOKOnly
  8.         ActiveWorkbook.Close SaveChanges:=False
  9.     End If
  10. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¸Ñ¨M¤F!
·PÁÂGª©¤j¥H¤ÎOª©¤jªºÀ°§U!
¶W±jªº©Ô!

TOP

        ÀR«ä¦Û¦b : §ïÅܦۤv¬O¦Û±Ï¡A¼vÅT§O¤H¬O±Ï¤H¡C
ªð¦^¦Cªí ¤W¤@¥DÃD