![]() |
Join Function in VB Excel2k
I need to create a string literal in Excel 2k VB language. Example below:
Part 1 in a procedure called Worksheet_Change Dim BkNme As String BkNme = "Book2.xls" Part 2 in a procedure called Wrkbk_Open(BkNme) Dim WrkBk As Workbook Dim BKPath As String BKPath = "C:\Documents and Settings\My Documents\Excel\" WrkBk = Join(BKPath, BkNme, """) WrkBk should end up with: "C:\Documents and Settings\My Documents\Excel\Book2.xls" so that the following function can use Workbooks.Open Filename:= _ WrkBk, UpdateLinks:=3 WrkBk should endup containing the following: "C:\Documents and Settings\My Documents\Excel\Book2.xls" |
Join Function in VB Excel2k
Rick,
Whilst you could use Join: BkNme = "Book2.xls" BKPath = "C:\Documents and Settings\My Documents\Excel" WrkBk = Join(BKPath, BkNme, "\") it would be more normal to concatenate: BkNme = "Book2.xls" BKPath = "C:\Documents and Settings\My Documents\Excel\" WrkBk = BKPath & BkNme Also, I'm somewhat doubt about the procedures you have <created. If these are supposed to be Excel event routines, it is better to get VBA to generate the signatures for you, to ensure they are correct. - Open the required module; e.g. double click Sheet1 in the VBE. - Select Worksheet from the top left combo in the code pane. - Select the required event (e.g. Change) from the top right combo in the code pane. NickHK "Rick" wrote in message ... I need to create a string literal in Excel 2k VB language. Example below: Part 1 in a procedure called Worksheet_Change Dim BkNme As String BkNme = "Book2.xls" Part 2 in a procedure called Wrkbk_Open(BkNme) Dim WrkBk As Workbook Dim BKPath As String BKPath = "C:\Documents and Settings\My Documents\Excel\" WrkBk = Join(BKPath, BkNme, """) WrkBk should end up with: "C:\Documents and Settings\My Documents\Excel\Book2.xls" so that the following function can use Workbooks.Open Filename:= _ WrkBk, UpdateLinks:=3 WrkBk should endup containing the following: "C:\Documents and Settings\My Documents\Excel\Book2.xls" |
All times are GMT +1. The time now is 10:58 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com