안녕하세요? 다음과 같이 한번 해보시기 바랍니다.
Private Sub CommandButton1_Click()
Dim strPath As String
Dim sht As Worksheet
strPath = Application.GetOpenFilename("Excel Files (*.xls), *.xls")
Workbooks.Open strPath
strPath = OriginFileName(strPath)
Workbooks(strPath).Activate
For Each sht In ActiveWorkbook.Sheets
sht.Cells.MergeCells = False
Next
End Sub
Function OriginFileName(strX As String) As String
Dim i As Integer
Dim X As Integer
For i = 1 To Len(strX)
If Mid(strX, i, 1) = "\" Then
X = i
End If
Next
OriginFileName = Right(strX, Len(strX) - X)
End Function
첫댓글 대단하시네요...^^ 감사합니다...정말 공부 열심히 해야겠다는 생각이...ㅎㅎ 근데 OriginFileName의 역할을 물어봐도 될까요?