Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I need to know how to reset a primary workbook to active after executing a
procedure to open a 2nd workbook. I used the following code to open the 2nd workbook: Public Static Sub OpenFiles(BkNme) Dim ThsWrkBk As Workbook Dim WorkBk As Workbook Dim WrkBk As String Dim BKPath As String Set ThsWrkBk = ActiveWorkbook BKPath = "C:\Documents and Settings\Richard L. Harig\My Documents\Excell\Financials\" WrkBk = BKPath & BkNme On Error Resume Next Set WorkBk = Workbooks(BkNme) If WorkBk Is Nothing Then On Error Resume Next Workbooks.Open Filename:=WrkBk, UpdateLinks:=3 End If End Sub |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Just add
ThsWrkBk.Activate at the end of the Sub. Tim "Rick" wrote in message ... I need to know how to reset a primary workbook to active after executing a procedure to open a 2nd workbook. I used the following code to open the 2nd workbook: Public Static Sub OpenFiles(BkNme) Dim ThsWrkBk As Workbook Dim WorkBk As Workbook Dim WrkBk As String Dim BKPath As String Set ThsWrkBk = ActiveWorkbook BKPath = "C:\Documents and Settings\Richard L. Harig\My Documents\Excell\Financials\" WrkBk = BKPath & BkNme On Error Resume Next Set WorkBk = Workbooks(BkNme) If WorkBk Is Nothing Then On Error Resume Next Workbooks.Open Filename:=WrkBk, UpdateLinks:=3 End If End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Display Current Date & Time in a cell: Everytime I open the workbo | Excel Worksheet Functions | |||
How do I update data in linked cells without opening source workbo | Excel Worksheet Functions | |||
SELECTING CURRENT DATE BY OPENING WORKBOOK | Excel Programming | |||
When opening an existing workbook, Excel opens but not the workbo. | Excel Discussion (Misc queries) | |||
opening a workbook in the current directory | Excel Programming |