嗔秤戻幣�哉膵�云利匈嬉蝕湊蛸賜�塋床四衲���萩晦編報炎嘔囚^泡仟 ̄云利匈�《超噌�殻窟�嵌虜隆輓麈觚翹瀘卉韮�仍仍�。� 烏御危列
卆卆弌傍 卦指云慕朕村 厘議慕尺 厘議慕禰 TXT畠云和墮 序秘慕杏 紗秘慕禰

excel_vba_園殻縮殻(頼屁井)-及47何蛍

梓囚徒貧圭�鮗� ○ 賜 ★ 辛酔堀貧和鍬匈��梓囚徒貧議 Enter 囚辛指欺云慕朕村匈��梓囚徒貧圭�鮗� ● 辛指欺云匈競何��
!!!!隆堋響頼��紗秘慕禰厮宴和肝写偬堋響��



繍乎斤�鷂較莇塹鷄篩拭I話羈茂魑諜擽�佩旗鷹  
Set objFile = fs。GetFile�─�C��WINNTSystem。ini;���察  �
幹秀才卦指斤C�此�WINNT議System。ini猟周斤�鶺漬�喘��旺拝繍凪験峙公斤�鷄篩�objFile。低辛參 
響函File斤�鶺頂楸猜�來��箭泌��objFile。Name囂鞘卦指乎猟周議頼屁猟周兆��囂鞘objFile。Drive 
卦指乎猟周侭侃議啣徒兆各��囂鞘objFile。DateCreated才objFile。DateLastModified蛍艶卦指乎 
猟周議幹秀晩豚才恷朔匯肝俐個晩豚。宸倖殻會辛參否叟仇俐個撹卦指猟周窃侏��奉來才万議幻猟 
周斜議兆各。萩編夕聞喘和峰峺綜低徭失俐個乎狛殻��objFile。Type�察�objFile。Attributes�察 �
objFile。ParentFolder參式 objFile。Size。壓斤�黻�誓匂戦中泣似File斤�鵤�心心購噐猟周��低 
珊辛參僥楼欺艶議焚担。  

25。FileSystemObjec 議圭隈才奉來  

FileSystemObjedt頁倖ActiveX陣周��戻工阻欺柴麻字猟周狼由議恵諒。乎斤�麑畊�阻載謹嶽圭隈�� 
燕8´3戦中双竃阻凪嶄議匯乂。  
  
    圭隈                                      宙峰  
    FileExists                                泌惚猟周贋壓祥卦指True  
                                              Sub FileExists�┌�   
                                              Dim fs As Object   
                                              Dim strFile As String   
                                              Set                    fs                    =  
                                               CreateObject�─�Scripting。FileSystemObject;��  
                                              strFile = InputBox�─�Enter the full name of the  
                                               file�此┌�   
                                              If fs。FileExists��strFile�� Then   
                                              MsgBox strFile & ; was found。;   
                                              Else   
                                              MsgBox ;File does not exist。;   
                                              End If   
                                              End Sub   
    GetFile                                   卦指匯斤��File  
    GetFileName                               卦指揮揃抄猟周兆  
    GetFileVersion                            卦指猟周井云  
    CopyFile                                  鹸崙猟周  
                                              Sub CopyFile�┌�   
                                              Dim fs As Object   
                                              Dim strFile As String   
                                              Dim strNewFile As String   
                                              strFile = ;C��Hello。doc;   
                                              strNewFile = ;C��Program FilesHello。doc;   
                                              Set                    fs                    =  

                                           156 

´ 匈中 173´

                                           CreateObject�─�Scripting。FileSystemObject;��  
                                           fspyFile strFile�察�strNewFile   
                                           MsgBox  ;A  copy  of  the  specified  file  was  
                                           created。;   
                                           Set fs = Nothing   
                                           End Sub  
MoveFile                                   卞強猟周  
DeleteFile                                 評茅猟周  
                                           Sub DeleteFile�┌�   
                                           Dim fs As FileSystemObject   
                                           Set fs = New FileSystemObject   
                                           fs。DeleteFile ;C��Program FilesHello。doc;   
                                           MsgBox ;The requested file was deleted。;   
                                           End Sub  
DriveExists                                泌公協啣徒贋壓夸卦指True  
                                           Function DriveExists��disk��   
                                           Dim fs As Object   
                                           Dim strMsg As String   
                                           Set                    fs                     =  
                                           CreateObject�─�Scripting。FileSystemObject;��   
                                           If fs。DriveExists��disk�� Then   
                                           strMsg = ;Drive ; & UCase��disk�� & ; exists。;  
                                           Else   
                                           strMsg = UCase��disk�� & ; was not found。;   
                                           End If   
                                           DriveExists = strMsg   
                                           ' run this function from the worksheet   
                                           '  by  entering  in  any  cell  the  following�此 �
                                           =DriveExists�─�E�此隠�   
                                           End Function  
GetDrive                                   卦指斤��Drive  
                                           Sub DriveInfo�┌�   
                                           Dim fs�察�disk�察�infoStr�察�strDiskName   
                                           strDiskName  =  InputBox�─�Enter  the  drive  
                                           letter�此┌察�_   
                                           ;Drive Name;�察 �C�此隠�   
                                           Set                    fs                     =  
                                           CreateObject�─�Scripting。FileSystemObject;��   
                                           Set                   disk                    =  
                                           fs。GetDrive��fs。GetDriveName��strDiskName����   
                                           infoStr = ;Drive�此 ─�& UCase��strDiskName�� &  
                                           vbCrLf   
                                           infoStr = infoStr & ;Drive letter�此 ─�& _   
                                           UCase��disk。DriveLetter�� & vbCrLf   
                                           infoStr  =  infoStr  &  ;Drive  Type�此  ─ �&  
                                           disk。DriveType & vbCrLf   
                                           infoStr = infoStr & ;Drive File System�此 ─�& _  
                                           disk。FileSystem & vbCrLf   
                                           infoStr = infoStr & ;Drive SerialNumber�此 ─�& _  
                                           disk。SerialNumber & vbCrLf   

                                        157 

´ 匈中 174´

                                          infoStr = infoStr & ;Total Size in Bytes�此 ─�&  
                                          _   
                                          FormatNumber��disk。TotalSize / 1024�察�0�� & ; Kb;  
                                          & vbCrLf   
                                          infoStr = infoStr & ;Free Space on Drive�此 ─�&  
                                          _   
                                          FormatNumber��disk。FreeSpace / 1024�察�0�� & ; Kb;  
                                          & vbCrLf   
                                          MsgBox    infoStr�察  �vbInformation�察    �Drive  
                                          Information;   
                                          End Sub   
GetDriveName                              卦指匯倖根嗤啣徒兆各賜宀利大慌�軛�各議忖憲堪 
                                          Function DriveName��disk��   
                                          Dim fs As Object   
                                          Dim strDiskName As String   
                                          Set                    fs                    =  
                                          CreateObject�─�Scripting。FileSystemObject;��   
                                          strDiskName = fs。GetDriveName��disk��     
                                          DriveName = strDiskName   
                                          ' run this function from the Immediate window  
                                          ' by entering ��DriveName�─�D�此隠�   
                                          End Function  
FolderExists                              泌猟周斜贋壓夸卦指True  
                                          Sub DoesFolderExist�┌�   
                                          Dim fs As Object   
                                          Set                    fs                    =  
                                          CreateObject�─�Scripting。FileSystemObject;��   
                                          MsgBox fs。FolderExists�─�C��Program Files;��   
                                          End Sub   
GetFolder                                 卦指斤��Folder  
                                          Sub FilesInFolder�┌�   
                                          Dim fs As Object   
                                          Dim objFolder As Object   
                                          Dim objFile As Object   
                                          Set                    fs                    =  
                                          CreateObject�─�Scripting。FileSystemObject;��   
                                          
卦指朕村 貧匯匈 和匯匈 指欺競何 壘��0�� 家��0��
隆堋響頼��紗秘慕禰厮宴和肝写偬堋響��
梁椣戻幣�� 梁心弌傍議揖扮窟燕得胎��傍竃徭失議心隈才凪万弌誌育断蛍�輌臆惨軼僑〃�燕慕得珊辛參資誼持蛍才将刮襲潜��範寔亟圻幹慕得 瓜寡追葎娼得辛參資誼寄楚署衛、持蛍才将刮襲潜填��