Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Excel Filename prgramatically

I have a line of code:

strThisFileName = "MY Excel FileName.xls"

How do I set my variable to the current excel filename?

strThisFileName = Workbooks.??

Thanks
Mike
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Excel Filename prgramatically

Use ThisWorkbook.Name

To get the path:
ThisWorkbook.Path

So your code would be:
strThisFileName = Thisworkbook.Name

Toby Erkson
Oregon, USA

On Fri, 16 Apr 2004 10:51:40 -0700, "Mike D" wrote:

I have a line of code:

strThisFileName = "MY Excel FileName.xls"

How do I set my variable to the current excel filename?

strThisFileName = Workbooks.??

Thanks
Mike


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Excel Filename prgramatically

Hi
strThisFileName = Activeworkbook.name

--
Regards
Frank Kabel
Frankfurt, Germany


Mike D wrote:
I have a line of code:

strThisFileName = "MY Excel FileName.xls"

How do I set my variable to the current excel filename?

strThisFileName = Workbooks.??

Thanks
Mike

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Excel Filename prgramatically

NeverMind

ThisWorkbook.Name
-----Original Message-----
I have a line of code:

strThisFileName = "MY Excel FileName.xls"

How do I set my variable to the current excel filename?

strThisFileName = Workbooks.??

Thanks
Mike
.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Excel Filename prgramatically

Hey, Mike.

Your Workbooks.??? method will DO something to the
workbook. You want to ask it something, I think.

strThisFileName = ActiveWorkbook.Name
strThisSheetName = ActiveSheet.Name

....assuming the reference is to an open workbook with an
active sheet. Before I run these lines, I reassure
myself with something like:

Range("C3").Select
Range("C3").Activate

Then the cell (or range) you have activated will also
activate that sheet and the book that contains it.

You may also have interest in:

ActiveWorkbook.SaveAs (strThisNewFileName)
ActiveWorkbook.Close

Anyway, I hope that's what you were looking for.

Good luck, it sounds like fun.

Matthew

=}




-----Original Message-----
I have a line of code:

strThisFileName = "MY Excel FileName.xls"

How do I set my variable to the current excel filename?

strThisFileName = Workbooks.??

Thanks
Mike
.

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
Excel adds a 1 to the end of the filename. pcgurudude Excel Discussion (Misc queries) 4 July 15th 08 02:16 PM
Cell("filename") doesn't update to new filename when do save as. Louis Excel Worksheet Functions 2 March 22nd 07 07:27 PM
set filename to <filename-date on open bob engler Excel Worksheet Functions 2 July 13th 06 05:11 AM
Excel puts a 1 at the end of my filename hammfamily Excel Discussion (Misc queries) 1 March 9th 05 12:47 AM
Saving filename same as import filename Matt Excel Programming 4 February 24th 04 03:01 PM


All times are GMT +1. The time now is 05:02 PM.

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

About Us

"It's about Microsoft Excel"