opening a workbook with VBA
I must be thick. How can I open a workbook with VBA?
|
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? |
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 - |
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 |
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 |
All times are GMT +1. The time now is 08:53 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com