D
Des Janke
Hi
Searched Google for this question but didn't find what I needed.
Have two workbooks with same name in different directories:
eg c:\menu.xlm
c:\subdir\menu.xlm
(this is a PeopleSoft nVision related issue, so code is in an XLM)
I have c:\subdir\menu.xlm active in Excel and click a button to call a
'switch' macro in another workbook c:\subdir\switch.xls. This macro is
supposed to open the c:\menu.xlm.
I use switch.xls to avoid 'file already open' errors when going from
c:\subdir\menu.xlm to c:\menu.xlm (the files have to be the same name).
All this works fine - but I'd like the c:\subdir\menu.xlm to close after
calling the 'switch' macro in switch.xls. Can't work out how to get this to
work. Can anyone help?
At present I'm using this code. It runs the SwitchtoDept macro just fine but
I'd like to close 'ThisWorkBook' as well
Sub SwitchFinToDept()
Dim Pathfile As String
Pathfile = ThisWorkbook.Path
Workbooks.Open Filename:=Pathfile & "\Switch.xls"
Application.Run "Switch.xls!SwitchtoDept"
ThisWorkbook.Close
End Sub
TIA
Des
Searched Google for this question but didn't find what I needed.
Have two workbooks with same name in different directories:
eg c:\menu.xlm
c:\subdir\menu.xlm
(this is a PeopleSoft nVision related issue, so code is in an XLM)
I have c:\subdir\menu.xlm active in Excel and click a button to call a
'switch' macro in another workbook c:\subdir\switch.xls. This macro is
supposed to open the c:\menu.xlm.
I use switch.xls to avoid 'file already open' errors when going from
c:\subdir\menu.xlm to c:\menu.xlm (the files have to be the same name).
All this works fine - but I'd like the c:\subdir\menu.xlm to close after
calling the 'switch' macro in switch.xls. Can't work out how to get this to
work. Can anyone help?
At present I'm using this code. It runs the SwitchtoDept macro just fine but
I'd like to close 'ThisWorkBook' as well
Sub SwitchFinToDept()
Dim Pathfile As String
Pathfile = ThisWorkbook.Path
Workbooks.Open Filename:=Pathfile & "\Switch.xls"
Application.Run "Switch.xls!SwitchtoDept"
ThisWorkbook.Close
End Sub
TIA
Des