• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Close file after a macro opens it [SOLVED]

brightyoyo

New Member
Hi


I have a macro to opens a specific file and copies data to my open workbook


Code:
Dim wb As Workbook

[code]Set wb = ThisWorkbook

[code]Workbooks.Open Filename:="WORKSTATION-48Excel Macro FilesPL_Import and [code]Conversion_Template_DATA_1.xlsm" '<<<< Change File Name

[code]Columns("B:B").Select

Selection.Copy

wb.Activate[/code]

Range("D1").Select[/code]

Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _[/code]

False, Transpose:=False[/code]


I would to add to the macro a way to close that file after the copying is done.


Thank You
 
Hi brightyoyo,


Could you please try


workbooks("PL_Import and Conversion_Template_DATA_1.xlsm").activate

activeworbook.close
 
Hi sachinbizboy


It worked perfectly, although it leaves a lot of information on the clipboard. Is there a way to empty the clipboard from the macro, instead of having the pop up message.


Thanks
 
Hi, brightyoyo!

Glad you solved it. Thanks for your feedback and for your kind words too. And welcome back whenever needed or wanted.

Regards!


@sachinbizboy

Hi!

Same for you, thank you.

Regards!
 
Back
Top