Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Saving a file with VBA that references current file name

I have a file that has code in it that references the file
name. Problem is when an end user gets the file they save
it as another name and subsequently get a run-time error.
Is there a way to change the VB references in the code to
point to the new file name? Muchos Gracis if you can help,
heck just thanks for reading!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Saving a file with VBA that references current file name

You can always refer to the workbook containing the code with ThisWorkbook.
From that, you can get the name of the file, if needed, with

ThisWorkbook.Name
' or
ThisWorkbook.FullName


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"chilidog1000" wrote in message
...
I have a file that has code in it that references the file
name. Problem is when an end user gets the file they save
it as another name and subsequently get a run-time error.
Is there a way to change the VB references in the code to
point to the new file name? Muchos Gracis if you can help,
heck just thanks for reading!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Saving a file with VBA that references current file name

If you just want to change the VB reference to the file just open the VB
editor and use the SEARCH and REPLACE feature to locate each instance
of the old filename in the code and then replace it with the new file
name.

Rollin



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/

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
Saving Excel 2007 file in 2003 creates very large file Jon Pearce Excel Discussion (Misc queries) 2 July 16th 09 07:20 PM
Saving only current worksheet into new file BobC Excel Discussion (Misc queries) 3 January 9th 09 01:16 PM
Saving file as current month name automatically gold Excel Discussion (Misc queries) 2 August 25th 07 05:34 PM
reading from another file and pasting to current file, "combobox" Darius New Users to Excel 1 September 26th 05 07:13 AM
How do I stop Excel 2000 from saving file history from file that . Cathy Excel Discussion (Misc queries) 0 March 29th 05 03:27 PM


All times are GMT +1. The time now is 05:34 AM.

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"