Home » excel » How to open another excel using VBA

How to open another excel using VBA

Posted by: admin May 14, 2020 Leave a comment

Questions:

I have tried to write a script to open another excel.

My code

Sub test()
filetoopen=thisworkbook.worksheet("sheet1").Range("D18")

Where is my mistake?

Thank you for your advice.

How to&Answers:

You can use:

Sub test()
filetoopen = ThisWorkbook.Worksheets("sheet1").Range("D18")
Workbooks.Open FileName:=filetoopen
ActiveWindow.ActivatePrevious