Home |
Search |
Today's Posts |
#10
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Norman, it is always best to have alternatives.
-- Leanne M (Aussie) (Changed Display name from Leanne) United Kingdom (Don''t ask me what an Aussie is doing living in the UK!) "Norman Jones" wrote: Hi Leanne, Correcting the path and folder assignments, the code should have read: '========== Private Sub CommandButton3_Click() Dim WB As Workbook Dim myFolder As String Dim myDrive As String Dim sStr As String Const sFolder As String = _ "C:\My Documents\Pest Control Management System" Const sFile As String = "Pest Control Reporting Tool.xls" On Error Resume Next Set WB = Workbooks(sFile) On Error GoTo 0 If WB Is Nothing Then myFolder = CurDir myDrive = CurDir ChDrive sFolder ChDir sFolder Set WB = Workbooks.Open( _ Filename:=sFolder _ & Application.PathSeparator _ & sFile) ChDrive myFolder ChDir myFolder Else WB.Activate End If End Sub '<<========== --- Regards. Norman |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Hyperlink to an exe file with switch. | Excel Discussion (Misc queries) | |||
how do you switch from auto open | Excel Discussion (Misc queries) | |||
Open File or Switch Between Windows if File is Open | Excel Programming | |||
Open File or Switch Between Windows if File is Open | Excel Programming | |||
Open Excel from VB using Read-Only switch? | Excel Programming |