Hello,
I am a little stumped on an issue that I am facing. I am simply trying to open a second workbook and am getting a type mismatch error. I can't figure out the issue and have spent hours debugging and searching around the internet. It seems to be whenever I try to load a 2nd file, no matter which order.
Thanks for the look!
I am a little stumped on an issue that I am facing. I am simply trying to open a second workbook and am getting a type mismatch error. I can't figure out the issue and have spent hours debugging and searching around the internet. It seems to be whenever I try to load a 2nd file, no matter which order.
Thanks for the look!
Code:
Sub Test()
Dim fname, ename, fpath, epath As Variant
Dim intChoicef, intchoicee As Integer
Dim fWorkBook, eWorkBook As Workbooks
With Workbooks("KPRO Summary Test 2")
fpath = Application.GetOpenFilename
If fpath <> False Then
fname = Mid(fpath, InStrRev(fpath, "\") + 1, (Len(fpath) - InStrRev(fpath, "\", 1)))
Workbooks("KPRO Summary Test 2").Sheets("Sheet1").Cells(1, 3).Value = "[" & fname & "]KPRO SUMMARY"
Set fWorkBook = Workbooks.Add(fpath)
Else
MsgBox "Please select a file"
End If
epath = Application.GetOpenFilename
If epath <> False Then
ename = Mid(epath, InStrRev(epath, "\") + 1, (Len(epath) - InStrRev(epath, "\", 1)))
Workbooks("KPRO Summary Test 2").Sheets("Sheet1").Cells(2, 3).Value = "[" & ename & "]CCIR Tracker"
Set eWorkBook = Workbooks.Add(epath)
Else
MsgBox "Please select a file"
End If
End With
Workbooks("KPRO Summary Test 2").Activate
End Sub