VBA를 사용하면 Windows Explorer에서 알려진 파일 유형의 파일 확장자가 숨겨져 있는지 확인할 수 있습니까?
-
19-09-2019 - |
문제
Windows 탐색기를 열지 않고. Word VBA에서 이것을 확인하고 싶습니다.
감사.
편집하다:
이 코드는 이제 작동합니다.
Set WshShell = CreateObject("WScript.Shell")
If WshShell.RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\HideFileExt") = 0 Then
MsgBox Prompt:="In Windows Explorer, set the folder options to hide file extensions of known file types." _
& vbCrLf & vbCrLf & " This prevents the file extension from appearing as part of the document number in" _
& "the document body and page headers.", Buttons:=vbOKOnly + vbCritical, Title:="Critical"
End If
해결책
레지스트리 값을 쿼리해야합니다
hkey_current_user 소프트웨어 microsoft windows currentversion explorer advanced hidefileext
이 값이 0이고 1 인 경우에 확장이 표시됩니다.
당신은 사용할 수 있습니다 후회 이 값을 읽는 WSHSHELL 개체의 메소드. VBA 프로젝트의 Windows 스크립트 호스트 객체 모델 유형 라이브러리에 대한 참조를 추가하여 WSHSHELL 객체를 사용할 때 강력한 입력을 얻을 수 있습니다.
제휴하지 않습니다 StackOverflow