Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hi Guys, From time to time, people rename files. I want to read the file name of an open workbook and store it as a variable. Essentially, avoiding the whole hardcoding the actual file name. Any Ideas guys? -- BrownTing ------------------------------------------------------------------------ BrownTing's Profile: http://www.excelforum.com/member.php...o&userid=34919 View this thread: http://www.excelforum.com/showthread...hreadid=562913 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You will still need to know the file name (or ask the user to supply it) in
order to open the workbook. Once there can set a refernce to it and use that through out your code. e.g. Dim WB As Workbook Private sub cmdOpenFile() Dim RetVal As Variant RetVal=Application.GetopenFileName() If RetVal<False Then Set WB=Workbooks.Open(RetVal) End If End Sub Is that what you mean ? NickHK "BrownTing" ¼¶¼g©ó¶l¥ó·s»D:BrownTing.2b78t5_1153324012.5459@ex celforum-nospam.com... Hi Guys, From time to time, people rename files. I want to read the file name of an open workbook and store it as a variable. Essentially, avoiding the whole hardcoding the actual file name. Any Ideas guys? -- BrownTing ------------------------------------------------------------------------ BrownTing's Profile: http://www.excelforum.com/member.php...o&userid=34919 View this thread: http://www.excelforum.com/showthread...hreadid=562913 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
ActiveWorkbook.FullName
or ThisWorkbook.FullName RBS "BrownTing" wrote in message ... Hi Guys, From time to time, people rename files. I want to read the file name of an open workbook and store it as a variable. Essentially, avoiding the whole hardcoding the actual file name. Any Ideas guys? -- BrownTing ------------------------------------------------------------------------ BrownTing's Profile: http://www.excelforum.com/member.php...o&userid=34919 View this thread: http://www.excelforum.com/showthread...hreadid=562913 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() thanks, i'll give it a shot... i'm going to trying and use ActiveWorkbook.Name and see what happens -- BrownTing ------------------------------------------------------------------------ BrownTing's Profile: http://www.excelforum.com/member.php...o&userid=34919 View this thread: http://www.excelforum.com/showthread...hreadid=562913 |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() I used the following; Dim BLABLA BLABLA = ActiveWorkbook.Name 'records the file name if it ever changed. MsgBox "sdfsags " & BLABLA Workbooks(BLABLA).Activate I have a problem with putting a variable as the particular workboo name. I'm just wondering if this is the right syntax. Workbooks(BLABLA).Activat -- BrownTin ----------------------------------------------------------------------- BrownTing's Profile: http://www.excelforum.com/member.php...fo&userid=3491 View this thread: http://www.excelforum.com/showthread.php?threadid=56291 |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
But the filename cannot not change whilst the WB is open.
dim WB as workbook set wb=activeworkbook msgbox wb.name wb.activate NickHK "BrownTing" wrote in message ... I used the following; Dim BLABLA BLABLA = ActiveWorkbook.Name 'records the file name if it every changed. MsgBox "sdfsags " & BLABLA Workbooks(BLABLA).Activate I have a problem with putting a variable as the particular workbook name. I'm just wondering if this is the right syntax. Workbooks(BLABLA).Activate -- BrownTing ------------------------------------------------------------------------ BrownTing's Profile: http://www.excelforum.com/member.php...o&userid=34919 View this thread: http://www.excelforum.com/showthread...hreadid=562913 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
refering to other workbooks | Excel Discussion (Misc queries) | |||
Refering to Cells | Excel Worksheet Functions | |||
set filename to <filename-date on open | Excel Worksheet Functions | |||
set excel <filename to <filename-date | Excel Programming | |||
Saving filename same as import filename | Excel Programming |