LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Referring to two different open worksheets in code

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
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
ON OPEN VBA Code input incorrectly now excel sheet wont open mmartin New Users to Excel 1 February 16th 11 11:33 PM
Referring to multiple worksheets leo Excel Worksheet Functions 1 February 5th 07 04:02 PM
Referring to multiple worksheets via a variable dc_area_mcse[_2_] Excel Programming 2 October 5th 06 03:36 PM
referring to worksheets by name in a vba fourier transform JacksonRJones Excel Programming 4 April 3rd 06 08:36 PM
VBA code for looping through open workbooks and worksheets Jamie Martin[_2_] Excel Programming 1 July 24th 03 06:44 PM


All times are GMT +1. The time now is 09:14 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"