如题所述
å
³äºï¼ä¸è¬æå¦ä¸ç两ç§æ¹å¼ã è¯·æ ¹æ®æ
åµï¼éæ©ä¸ç§éåä½ çæ¹æ³ã ä¸ãéè¿FileExistså¤ææ件æ¯å¦åå¨ Dim MyFile As Object Set MyFile = CreateObject("Scripting.FileSystemObject") If MyFile.FileExists("E:\dzwebs\Pic\logo.gif" ) = True Then MsgBox "æ件åå¨" Else MsgBox "æ件ä¸åå¨" End If 以ä¸ä»£ç å¨VBAç¯å¢ä¸ä½¿ç¨ãæè
å°å
¶å¶ä½æ为å®ä¹å¯ä»¥ã"E:\dzwebs\Pic\logo.gif"为æ件路å¾åæ件å称ï¼å¯èªè¡ä¿®æ¹ã äºãéè¿Diræ¥å¤æ Dim YouFile As String YouFile = Dir("E:\MyPictures\Pic\logo.gif") If x <> "" Then MsgBox "æ件åå¨" Else MsgBox "æ件ä¸åå¨" Endif "E:\MyPictures\Pic\logo.gif"为æ件路å¾åæ件å称ï¼å¯èªè¡ä¿®æ¹ãå½ç¶ï¼å¦ä¸ä»£ç ï¼ä¹å¨VBAä¸ä½¿ç¨ï¼å¯èªä½æ为å®æå½æ°é½å¯ä»¥ã ä¸é¢ç两ç§æ¹æ³ï¼æ¬ç«æ¨èä½ ä½¿ç¨ç¬¬ä¸ç§æ¹æ³ï¼å 为第ä¸ç§æ¹æ³æ¯è¾ç¬¦åé»è¾æç»´ã
温馨提示:答案为网友推荐,仅供参考