Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Can you help - Users of my form need to make sure Doc2 is open before running
the macro. If Doc2 is not open I need the macro to stop and a message box to pop up stating Doc2 is not open. Application.WindowState = xlMinimized Range("H2").Select Selection.Copy Range("E1").Select ActiveSheet.Paste |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dim Doc2Wkbk as workbook
set doc2wkbk = nothing on error resume next set doc2wkbk = workbooks("doc2.xls") 'no drive and no path on error goto 0 if doc2wkbk is nothing then msgbox "It's not open" exit sub end if ========= Maybe you could have your code just open it (if you know where it is): if doc2wkbk is nothing then on error resume next 'include drive and path on the next line set doc2wkbk = workbooks.open(filename:="c:\path\doc2.xls") on error goto 0 if doc2wkbk is nothing then msgbox "it's not open and I don't know where it is! exit sub '???? else msgbox "it was opened, but now it is!" end if end if Munchkin wrote: Can you help - Users of my form need to make sure Doc2 is open before running the macro. If Doc2 is not open I need the macro to stop and a message box to pop up stating Doc2 is not open. Application.WindowState = xlMinimized Range("H2").Select Selection.Copy Range("E1").Select ActiveSheet.Paste -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
auto open workbook to make read-only | Excel Programming | |||
Make Workbook Password protected tp open | Excel Discussion (Misc queries) | |||
Verify before proceeding | Excel Programming | |||
How do i make excel open a new workbook and run a query from sql | Excel Programming | |||
How do I make an open workbook the active workbook | Excel Programming |