Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
opening a workbook with VBA
I must be thick. How can I open a workbook with VBA?
|
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
opening a workbook with VBA
Workbooks.Open("path to your workbook\name of your workbook.xls")
On Apr 8, 4:15*pm, wrote: I must be thick. How can I open a workbook with VBA? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
opening a workbook with VBA
Sorry the brackets are not required as it's being used as a procedure
not a function. Workbooks.Open "path to your workbook\name of your workbook.xls" Cheers, Jason Lepack On Apr 8, 4:24*pm, Jason Lepack wrote: Workbooks.Open("path to your workbook\name of your workbook.xls") On Apr 8, 4:15*pm, wrote: I must be thick. How can I open a workbook with VBA?- Hide quoted text - - Show quoted text - |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
opening a workbook with VBA
On 8 Apr, 21:25, Jason Lepack wrote:
Sorry the brackets are not required as it's being used as a procedure not a function. Workbooks.Open "path to your workbook\name of your workbook.xls" Cheers, Jason Lepack On Apr 8, 4:24*pm, Jason Lepack wrote: Workbooks.Open("path to your workbook\name of your workbook.xls") On Apr 8, 4:15*pm, wrote: I must be thick. How can I open a workbook with VBA?- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text - Thanks very much Jason! You have proved my thickness. I was using brackets instead of quotes.....another day wasted<sigh Thanks again. Wayne |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
opening a workbook with VBA
Now, if you were intending to do more with that worksheet then these
are some common variables that I use: option explicit public sub do_stuff_with_wb() dim wb as workbook dim ws as Worksheet dim r as range set wb = Workbooks.open("wb_path\wb_name.xls") set ws = wb.activesheet ' uses the active sheet of the workbook just opened set ws = wb.sheets(2) ' uses the second sheet of the workbook set ws = wb.sheets.add ws.name = "your_sheet" set r = ws.range("A1") ' r points to cell A1 of your_sheet set r = ws.offset(2,2) ' moves two rows down and two colums right (C3) set r = ws.offset(-1,-1) ' moves one row up and one column left (B2) r.value = "Hi!" ' sets the value of B2 to "Hi!" set r = nothing set ws = nothing set wb = nothing end sub Cheers, Jason Lepack On Apr 9, 3:27 am, wrote: On 8 Apr, 21:25, Jason Lepack wrote: Sorry the brackets are not required as it's being used as a procedure not a function. Workbooks.Open "path to your workbook\name of your workbook.xls" Cheers, Jason Lepack On Apr 8, 4:24 pm, Jason Lepack wrote: Workbooks.Open("path to your workbook\name of your workbook.xls") On Apr 8, 4:15 pm, wrote: I must be thick. How can I open a workbook with VBA?- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text - Thanks very much Jason! You have proved my thickness. I was using brackets instead of quotes.....another day wasted<sigh Thanks again. Wayne |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I stop blank workbook from opening when opening an existing | Excel Discussion (Misc queries) | |||
excel VBA problem - setting workbook as variable & opening/re-opening | Excel Programming | |||
How to make the opening of a workbook conditional upon the opening of another workbook | Excel Programming | |||
How to make opening of workbook conditional of opening of another workbook | Excel Programming | |||
Preventing opening workbook inside active workbook. | Excel Programming |