View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Ozgur Pars[_2_] Ozgur Pars[_2_] is offline
external usenet poster
 
Posts: 70
Default Activating previously used workbook

Hi Ivan,
I am probably not very clear about the problem I face(sorry).
I tried thisworkbook.activate before but it did not work...

Last line activesheet.paste gives and error.

Sub Import()
Workbooks.Open Filename:="R:\treasury\DAILY\May06\daily.xls"
Range("A2:L2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Application.CutCopyMode = False
Windows("daily.xls").Close
ThisWorkbook.Activate
Sheets(1).Select
Range("A2").Select
ActiveSheet.Paste
End Sub

Thanks for your time.
Ozgur
"Ivan Raiminius" wrote:

Hi Ozgur,

if the procedure is in the workbook you need to activate, you can use:

thisworkbook.activate

if the workbook is different from that in which is the macro, you have
to create or open it, so you should be able to set it to object
variable.

But maybe I didn't understand you correctly.

Regards,
Ivan