View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
Don Guillett
 
Posts: n/a
Default Check if workbook open


I would execute the macro I sent FIRST and then modify yours to remove the
selections.
This should get you going.

Sub copyfrom()
dwb = "workbooktocopyto.xls"
dws = "sheettocopyto"
swb = "worbooktocopyfrom.xls"
sws = "sheetctocopyfrom"

Windows(swb).Activate

'Sheets(sws).Range("b4:d4").Copy _
'Workbooks(dwb).Sheets(dws).Range("a15")

'Get Values ONLY without changing to values first
Workbooks(dwb).Sheets(dws).Range("b15:d15").Value = _
Sheets(sws).Range("b4:d4").Value

End Sub





--
Don Guillett
SalesAid Software

"dkipping" wrote in
message ...

Sorry but I can't seem to make that work. The actual sub I'm using is as
below. Could you please alter to check if "Orders.xls" is open using
your routine.
Many thanks for your interest
David

Sub SaveOrder()
'
' SaveOrder Macro
' Macro recorded 19/05/2006 by David
'

'
Range("A1:M36").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Selection.Copy
Workbooks.Open Filename:="C:\My Documents\Orders\POTemp.xls"
ActiveSheet.Paste
Windows("Purchase Order.xls").Activate
Sheets("3").Select
Range("A2:M21").Select
Selection.Copy
Workbooks.Open Filename:="C:\My Documents\Orders\Orders.xls"
Sheets("Orders").Select
Range("A1").Select
Range("A1").End(xlDown).Select
ActiveCell.Offset(1, 0).Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Range("A1").Select
ActiveWorkbook.Save
ActiveWindow.Close
Windows("Purchase Order.XLS").Activate
Sheets("1").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sheets("2").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Windows("POTemp.XLS").Activate
ActiveSheet.Shapes("Button 2").Select
Selection.Cut
ActiveSheet.Shapes("Button 1").Select
Selection.Cut
ChDir "C:\My Documents\Orders"
ActiveWorkbook.SaveAs Filename:= _
Range("h11"), FileFormat:=xlNormal, _
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False,
_
CreateBackup:=False
ActiveWorkbook.Close
Windows("Purchase Order.XLS").Activate
ActiveWorkbook.Close

End Sub


--
dkipping
------------------------------------------------------------------------
dkipping's Profile:
http://www.excelforum.com/member.php...o&userid=34683
View this thread: http://www.excelforum.com/showthread...hreadid=544484