Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 186
Default Referencing Workbook Name

I have the following VBA code in which I am identifying the number of rows in
a workbook named "FileOpenNameLast." This name includes the full path of the
workbook and, therefore, my code deosn't work. Isn't there a simple way to
refer to the workbook name in my code?

NumRowsF832 =
Workbooks(FileOpenNameLast).Name.Sheets(1).Range(" A65536").End(xlUp).Row



--
Ken Hudson
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,120
Default Referencing Workbook Name

When accessing an open file, you don't use the path.

Best way is to get the name when you open it.

--
HTH

Bob Phillips

"Ken Hudson" wrote in message
...
I have the following VBA code in which I am identifying the number of rows

in
a workbook named "FileOpenNameLast." This name includes the full path of

the
workbook and, therefore, my code deosn't work. Isn't there a simple way to
refer to the workbook name in my code?

NumRowsF832 =
Workbooks(FileOpenNameLast).Name.Sheets(1).Range(" A65536").End(xlUp).Row



--
Ken Hudson



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Referencing Workbook Name

If xl2000 or later

Dim v as Variant
Dim sName as String
Dim FileOpenNameLast as String

' code that populates FileOpenNameLast with a fully qualified path name
v = Split(FileOpenNameLast,"\")
sName = v(ubound(v))
NumRowsF832 =
Workbooks(sName).Sheets(1).Range("A65536").End(xlU p).Row

--
Regards,
Tom Ogilvy


"Ken Hudson" wrote in message
...
I have the following VBA code in which I am identifying the number of rows

in
a workbook named "FileOpenNameLast." This name includes the full path of

the
workbook and, therefore, my code deosn't work. Isn't there a simple way to
refer to the workbook name in my code?

NumRowsF832 =
Workbooks(FileOpenNameLast).Name.Sheets(1).Range(" A65536").End(xlUp).Row



--
Ken Hudson



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
Referencing other workbook. [email protected] Excel Worksheet Functions 1 September 4th 06 05:59 PM
Referencing a different Workbook Ken Excel Worksheet Functions 8 November 24th 05 01:20 AM
Referencing another Workbook Bill Martin -- (Remove NOSPAM from address) Excel Discussion (Misc queries) 0 April 6th 05 07:16 PM
referencing another workbook steve Excel Programming 0 May 7th 04 02:49 PM
Referencing one workbook in other??? Haldun Alay[_2_] Excel Programming 3 August 20th 03 04:29 PM


All times are GMT +1. The time now is 10:03 AM.

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"