LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Cell reference to determine filename

Try the below

Dim strFile as String
strFile = Workbooks("macro test.xls").Sheets("Sheet1").Range("C10")

OR
'if this is the active workbook
strFile = Sheets("Sheet1").Range("C10")

ActiveWorkbook.SaveAs Filename:=strFile
--
If this post helps click Yes
---------------
Jacob Skaria


"cangiff" wrote:

I am trying to write a macro that saves a current file to a new file.

in the VBA line: ActiveWorkbook.SaveAs Filename =

I want to add a reference to the cell that contains the required filename. I
have therefore tried adding the following:

ActiveWorkbook.SaveAs Filename = "=' [macro test.xls] Sheet 1' !R10C3"

This address contains the desired filename. However when I run the macro it
fails as "the file could not be accessed......."

I suspect my programmming is flawed. Can you help?

Actiallows me to put the required filename that I wish to save to in as a
--
cangiff

 
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
Cell reference to a filename Stevep4 Excel Discussion (Misc queries) 10 January 14th 09 10:30 PM
How Determine, cell has got reference. kris Excel Programming 4 September 30th 07 03:54 PM
Excel - print to .pdf using filename reference from cell scooppbear Excel Discussion (Misc queries) 1 May 17th 06 02:36 AM
Reference filename used in code from cell [email protected] Excel Programming 5 March 15th 06 02:53 PM
substitute the filename in a cell reference with a string in another cell. flummi Excel Discussion (Misc queries) 11 February 22nd 06 01:14 PM


All times are GMT +1. The time now is 07:01 PM.

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"