Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Kaak,
I've tried your code (bottom of this message) and I got a "Compile error: Else Without If" error message with the highlighter stopping at [Else: MsgBox FileName & " is not open"]. If the file is already opened, how do I activate (go to) it, copy and paste to the current worksheet? If the file isn't already opened, then my original code would do the trick. I need a workaround for when the target file is already opened. Otherwise, I would have to close it first before triggering my original macro. Thanks in advance again, Ricky Sub CheckForFile() Dim FileName As String Dim x As Workbook FileName = "budget.XLS" On Error Resume Next Set x = Workbooks(FileName) If Err = 0 Then MsgBox FileName & " is open" Else: MsgBox FileName & " is not open" End If On Error GoTo 0 End Sub *** Sent via Developersdex http://www.developersdex.com *** |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
unable to open .xlb file in Windows 7 | Excel Discussion (Misc queries) | |||
File Open Vs Opening from Windows Explorer | Excel Discussion (Misc queries) | |||
In Excel - Use Windows Explorer instead of File Open to open file | Excel Discussion (Misc queries) | |||
WINDOWS CANNOT OPEN THIS FILE IN A:\ DRIVE | Excel Discussion (Misc queries) | |||
Open email windows can't open, excel shreadsheet file .xls ? | Excel Discussion (Misc queries) |