B
Barb Reinhardt
I'm in a bit of a quandry and I'm sure someone here can help me out.
I have the following snippet of code:
With Application.FileDialog(msoFileDialogFilePicker)
.AllowMultiSelect = False
.Filters.Clear
.Filters.Add "Excel Files", "*.xls"
.FilterIndex = 1
.Title = "Please Select a PIID Workbook to open"
If .Show = False Then Exit Sub
sFile = .SelectedItems(1)
End With
ShortName = Right(sFile, Len(sFile) - InStrRev(sFile, "\"))
If ShortName = aWB.Name Then
MsgBox ("You've chosen to update the active workbook." & vbNewLine & _
"Choose another workbook to update")
GoTo EndSub
End If
On Error Resume Next
Set oPIIDWB = Nothing
Set oPIIDWB = Workbooks(ShortName)
On Error GoTo 0
If oPIIDWB Is Nothing Then
Application.StatusBar = "Opening " & ShortName
Set oPIIDWB = Workbooks.Open(sFile, UpdateLinks:=False)
End If
and this works if I'm opening the PIID workbook from somewhere on my
computer. HOWEVER ... this workbook is stored on a TeamSite. I run the
code from a workbook I'm referring to as aWB. How do I identify another
open workbook as OWB without opening it programmatically.
Thanks,
Barb Reinhardt
I have the following snippet of code:
With Application.FileDialog(msoFileDialogFilePicker)
.AllowMultiSelect = False
.Filters.Clear
.Filters.Add "Excel Files", "*.xls"
.FilterIndex = 1
.Title = "Please Select a PIID Workbook to open"
If .Show = False Then Exit Sub
sFile = .SelectedItems(1)
End With
ShortName = Right(sFile, Len(sFile) - InStrRev(sFile, "\"))
If ShortName = aWB.Name Then
MsgBox ("You've chosen to update the active workbook." & vbNewLine & _
"Choose another workbook to update")
GoTo EndSub
End If
On Error Resume Next
Set oPIIDWB = Nothing
Set oPIIDWB = Workbooks(ShortName)
On Error GoTo 0
If oPIIDWB Is Nothing Then
Application.StatusBar = "Opening " & ShortName
Set oPIIDWB = Workbooks.Open(sFile, UpdateLinks:=False)
End If
and this works if I'm opening the PIID workbook from somewhere on my
computer. HOWEVER ... this workbook is stored on a TeamSite. I run the
code from a workbook I'm referring to as aWB. How do I identify another
open workbook as OWB without opening it programmatically.
Thanks,
Barb Reinhardt