View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gary Keramidas Gary Keramidas is offline
external usenet poster
 
Posts: 2,494
Default Open a workbook from a written path

one way, but you don't specify if the path has a trailing backslash or not,
whether you want read only or not.
there are a few options.


i just used B3 on sheet1 and my value didn't have a backslash, so i added one
within the code


Sub open_file()
Dim ws As Worksheet
Dim fpath As String

Set ws = Worksheets("Sheet1")
fpath = ws.Range("B3").Value & "\"
Workbooks.Open (fpath & "filename.xls")

End Sub

--


Gary


"Ricardo Silva" wrote in message
...
Hi,
I would like to run a macro that would open a workbook in which the path is
written in a cell.
Can someone help me?
Cheers
Ricardo