반응형
Excel VBA 폴더 열기
2010 Excel VBA 사용 - 서브를 통해 폴더를 열려고 합니다.내가 여기서 뭘 잘못하고 있는 거지?
VBA
Sub openFolder()
Dim preFolder As String, theFolder As String, fullPath as String
theFolder = Left(Range("T12").Value, 8)
preFolder = Left(Range("T12").Value, 5) & "xxx"
fullPath = "P:\Engineering\031 Electronic Job Folders\" & preFolder & "\" & theFolder
Shell(theFolder, "P:\Engineering\031 Electronic Job Folders\" & preFolder, vbNormalFocus)
End Sub
Windows 파일 탐색기를 열려면 탐색기를 호출해야 합니다.exe
Call Shell("explorer.exe" & " " & "P:\Engineering", vbNormalFocus)
등가 구문
Shell "explorer.exe" & " " & "P:\Engineering", vbNormalFocus
이를 사용하여 워크북을 열고 워크북의 데이터를 템플릿에 복사합니다.
Private Sub CommandButton24_Click()
Set Template = ActiveWorkbook
With Application.FileDialog(msoFileDialogOpen)
.InitialFileName = "I:\Group - Finance" ' Yu can select any folder you want
.Filters.Clear
.Title = "Your Title"
If Not .Show Then
MsgBox "No file selected.": Exit Sub
End If
Workbooks.OpenText .SelectedItems(1)
'아래는 워크북의 새 시트에 파일을 복사하고 시트 1에 해당 값을 붙여넣는 것입니다.
Set myfile = ActiveWorkbook
ActiveWorkbook.Sheets(1).Copy after:=ThisWorkbook.Sheets(1)
myfile.Close
Template.Activate
ActiveSheet.Cells.Select
Selection.Copy
Sheets("Sheet1").Select
Cells.Select
ActiveSheet.Paste
End With
언급URL : https://stackoverflow.com/questions/17426704/excel-vba-open-a-folder
반응형
'programing' 카테고리의 다른 글
ASP.NET의 POST 메서드에서 데이터 검색 (0) | 2023.06.14 |
---|---|
Toad에서 저장 프로시저를 디버그하는 방법은 무엇입니까? (0) | 2023.06.14 |
요청이 중단되었습니다.SSL/TLS 보안 채널을 생성할 수 없습니다. (0) | 2023.06.14 |
Are digraphs and trigraphs in use today? (0) | 2023.06.14 |
NS 기본 실행 루프 모드 대 NS 실행 루프 공통 모드 (0) | 2023.06.14 |