Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 334
Default 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"

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default 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"



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Workbook_Open event not firing for Excel2K John Keith[_2_] Excel Programming 4 February 15th 06 02:44 PM
Arrays and Join Function Stefano Condotta Excel Programming 2 January 8th 06 11:20 PM
Function: Join Cells with Format Alexey E. Kolmyk Excel Programming 3 December 13th 03 03:09 PM
extracting data from word2k to excel2k Keith Willshaw Excel Programming 0 August 5th 03 01:59 PM


All times are GMT +1. The time now is 07:36 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"