ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   a macro that launches another workbook automatically (https://www.excelbanter.com/excel-programming/322605-macro-launches-another-workbook-automatically.html)

mtjarrett

a macro that launches another workbook automatically
 
hey folks,

here's the deal. i need a macro that can sit on a sheet in a master
workbook and when i type a number (a filename) into a cell, lets say
cell D3, and then press enter, i need this macro to automatically open
the file i just typed. for instance, if i type in "406" into the cell
D3. when i press enter i want file 406.xls to open and minimize (so
that i can have access to information in that workbook).

thanks


Tom Ogilvy

a macro that launches another workbook automatically
 
Use the Change event for that sheet.

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim bk as Workbook
If Target.Address = "$D$3" then
if not isempty(Target) then
set bk = workbooks.Open( Target.Value)
bk.Windows(1).WindowState = xlMinimized
End if
end if
End Sub

Right click on the sheet tab and select view code. Then put in a procedure
like the above. (you can paste this one in for a start.) You may need to
specify the path and so forth.

--
Regards,
tom Ogilvy



"mtjarrett" wrote in message
ups.com...
hey folks,

here's the deal. i need a macro that can sit on a sheet in a master
workbook and when i type a number (a filename) into a cell, lets say
cell D3, and then press enter, i need this macro to automatically open
the file i just typed. for instance, if i type in "406" into the cell
D3. when i press enter i want file 406.xls to open and minimize (so
that i can have access to information in that workbook).

thanks




mtjarrett

a macro that launches another workbook automatically
 
thanks



All times are GMT +1. The time now is 05:30 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com