Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default File name into a variable

In an excel macro, how can I place the name of the file I
am working on into a variable?

Thanks for your help in advance,
Tim
  #2   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default File name into a variable

The code gives the name of the VB file, not the excel
file. Is there a way to give the name of the excel file?

-----Original Message-----
Hi,

Supposing the variable is called 's', you would do:

Dim s As String
s = ThisWorkbook.name

Regards,

Alex

"Tim" wrote:

In an excel macro, how can I place the name of the file

I
am working on into a variable?

Thanks for your help in advance,
Tim

.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default File name into a variable

The code gives the name of the VB file, not the excel
file. Is there a way to give the name of the excel file?

???????

Public Sub myFile()
Dim s As String
s = ThisWorkbook.Name
MsgBox (s)
End Sub


--
----------------------------
Mauro Gamberini


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default File name into a variable

No it does not. It gives the name of the excel file. "ThisWorkbook" means "this excel file". Please try out the code before replying, as you mislead other users.

" wrote:

The code gives the name of the VB file, not the excel
file. Is there a way to give the name of the excel file?

-----Original Message-----
Hi,

Supposing the variable is called 's', you would do:

Dim s As String
s = ThisWorkbook.name

Regards,

Alex

"Tim" wrote:

In an excel macro, how can I place the name of the file

I
am working on into a variable?

Thanks for your help in advance,
Tim

.


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
Variable File Name Tigerxxx Excel Discussion (Misc queries) 4 March 8th 09 05:24 AM
calling a value from another file using a variable in the file nam DA_Potts[_2_] Excel Worksheet Functions 3 December 3rd 07 12:25 AM
calling a value from another file using a variable in the file nam DA_Potts[_2_] Excel Discussion (Misc queries) 4 December 2nd 07 11:09 PM
Variable File Name [email protected] Excel Worksheet Functions 1 June 18th 06 10:36 AM
Variable File Name Trevor[_4_] Excel Programming 3 June 18th 04 07:10 PM


All times are GMT +1. The time now is 08:08 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"