Home |
Search |
Today's Posts |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Now it works. Many thanks!
Maria -----Original Message----- sName contains a value like "C:\Myfolder\MyFile.xls" I provided a variable that holds a reference to the newly opened file Dim sName as String Dim rng as Range set rng = ActiveCell chDrive "C" ChDir "C:\Myfolder" sName = Application.GetOpenfileName() if sName < "False" then set bk = Workbooks.Open(sName) else exit sub End if rng.Value = bk.Sheets("Hourly Data") _ .Range("CU1").Value or if you need the filename, after opening: sName = bk.name also when the workbook is opened, it will be the activeworkbook unless you do something to make it not the activeworkbook. -- Regards, Tom Ogilvy "Maria" wrote in message ... Thank you, Tom! Now I have problems adressing the workbook. I tried the following: ActiveCell.Value = (Workbooks(sName).Sheets("Hourly Data").Range("CU1").Value) This produces a run time error - what can I do? Thanks for your help again ... Maria -----Original Message----- use the file open dialog Dim sName as String chDrive "C" ChDir "C:\Myfolder" sName = Application.GetOpenfileName() if sName < "False" then set bk = Workbooks.Open(sName) else exit sub End if msgbox bk.Name & " has been opened" -- Regards, Tom Ogilvy "Maria" wrote in message ... Hello there, I would like to create an InputBox that gives the user the possibility to decide which file to open - he/she should type in the whole path. Is that possible, and if it is how am I going to do it? Then, if the macro should work with the open file, how can I adress it? (The files look all the same but have slightly different names and different data ...) Thanks for your help! Maria . . |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
emailing files from excel, the files will not go until I open up . | New Users to Excel | |||
how do I toggle between 2 open excel files and leave both open | Excel Discussion (Misc queries) | |||
How to change default Open/Files of Type to "Microsoft Excel Files | Excel Discussion (Misc queries) | |||
file open via IE hyperlink causes already open files to shrink and tile | Setting up and Configuration of Excel | |||
Open Folder from inputbox | Excel Programming |