Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Open a workbook from a written path
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Open a workbook from a written path
On Sun, 21 Sep 2008 21:23:02 -0700, Ricardo Silva wrote:
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 If path is stored in cell B2 on Sheet1, the macro would contain this: Workbooks.Open ThisWorkbook.Worksheets("Sheet1").Range("B2").Text HTH B. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Open a workbook from a written path
On Sep 21, 10:41*pm, Boris wrote:
On Sun, 21 Sep 2008 21:23:02 -0700, Ricardo Silva wrote: 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 If path is stored in cell B2 on Sheet1, the macro would contain this: Workbooks.Open ThisWorkbook.Worksheets("Sheet1").Range("B2").Text HTH B. Gary and Boris, I get a subs-script out of range on both proposed solutions. I used "A20" as my range. Ideas? Don in Montana |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Open a workbook from a written path
Hi Don,
It worked for me for Excel 2000 using Sub openfile() Workbooks.Open ThisWorkbook.Worksheets("Sheet1").Range("a3").Text End Sub Did you change the range to match "A20"? If so, it sounds like your path is not complete, to me. Dan |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Open a workbook from a written path
On Mon, 22 Sep 2008 15:09:15 -0700 (PDT), HappySenior wrote:
Gary and Boris, I get a subs-script out of range on both proposed solutions. I used "A20" as my range. Ideas? Don in Montana Have you changed "Sheet1" to the name of your worksheet and entered "A20" as a range? B. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
open Workbook path | Excel Programming | |||
Can a macro be written that when you open a workbook the zoom will be set for each sheet? | Excel Programming | |||
Open Workbook using URL instead of network path | Excel Programming | |||
Get path of open workbook | Excel Programming | |||
how to open workbook without hardcoding path | Excel Programming |