<06-10 특정 파일만 자동으로 가져와서 작업하기>
작성자 정보
- 모아 작성
- 작성일
컨텐츠 정보
- 21 조회
- 0 추천
- 0 비추천
- 목록
본문
<06-10 특정 파일만 자동으로 가져와서 작업하기>
Dim FN As String
Dim wb As Workbook
Dim ws As Worksheet
Application.ScreenUpdating = False
FN = Environ("userprofile") & "\Desktop\Test\Test.xlsx"
If IsFileExist(FN) = False Then
MsgBox "파일이 존재하지 않습니다"
Exit Sub
End If
If IsFileOpen(FN) = True Then
MsgBox "파일이 이미 열려 있습니다. 닫고 다시 시작하세요"
Exit Sub
End If
Set wb = Workbooks.Open(Filename:=FN, UpdateLinks:=0)
Set ws = wb.Sheets(1)
'to do
wb.Close False
Application.ScreenUpdating = True
Set wb = Nothing
Set ws = Nothing
'----------------------------------------------------------------------------
Function IsFileExist(FN As String) As Boolean
IsFileExist = (Dir(FN) <> "")
End Function
'-----------------------------------------------------------------------------
Function IsFileOpen(FN As String) As Boolean
Dim OpenFName As Workbook
On Error Resume Next
Set OpenFName = Workbooks(Dir(FN))
IsFileOpen = (Err.Number = 0)
End Function
출처: https://lesserpainbetterlife.tistory.com/812 [전진수블로그 ✝ = ♥:티스토리]
|
포인트 선물 선물명단 선물하기
최소 5P ~ 최대 100000000P 까지 가능합니다.
로그인 후 선물하실 수 있습니다.
선물 받은 내용이 없습니다.
관련자료

모아
ex.9
-
등록일 05:56
-
등록일 05:56
-
등록일 05:56
-
등록일 05:55
댓글 0
등록된 댓글이 없습니다.