Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default New Spreadsheet Name

I have a list of doctors that I need to create templates for and then
refresh the background query (the spreadsheet is linked to SQL) . I
have the logic worked out, the only problem that I am having is that
when it comes to saving the file name, I have the doctors name in Cell
A5, this is a dynmic field based on the query, how I do fix the
following line of code to tell it to look at A5 for the file name? I
thought I would be able to copy from cell A5 and paste it into the file
name, but that is not working, any other suggestions?

The line of code to save the workbook is:

ActiveWorkbook.SaveAs Filename:= _
"C:\Documents and Settings\Richard
Sabbara\Desktop\Range('C1')", FileFormat _
:=xlNormal, Password:="", WriteResPassword:="",
ReadOnlyRecommended:= _
False, CreateBackup:=False

Any help is greatly appericated.

Richard

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 102
Default New Spreadsheet Name


wrote:
I have a list of doctors that I need to create templates for and then
refresh the background query (the spreadsheet is linked to SQL) . I
have the logic worked out, the only problem that I am having is that
when it comes to saving the file name, I have the doctors name in Cell
A5, this is a dynmic field based on the query, how I do fix the
following line of code to tell it to look at A5 for the file name? I
thought I would be able to copy from cell A5 and paste it into the file
name, but that is not working, any other suggestions?

The line of code to save the workbook is:

ActiveWorkbook.SaveAs Filename:= _
"C:\Documents and Settings\Richard
Sabbara\Desktop\Range('C1')", FileFormat _
:=xlNormal, Password:="", WriteResPassword:="",
ReadOnlyRecommended:= _
False, CreateBackup:=False


I am a bit rusty with this but I think your using incorrect syntax for
what you want to do with Range('C1'). Try the following:

Dim CurRng As Range
Set CurRng = Range("C1")
ActiveWorkbook.SaveAs Filename:="C:\Documents and
Settings\RichardSabbara\Desktop\" & CurRng, _
FileFormat:=xlNormal, Password:="", WriteResPassword:="",
ReadOnlyRecommended:=False, CreateBackup:=False

The reason I use a variable for Range("C1") is because I find it
IMPOSSIBLE to figure out the correct syntax for all of the quotation
marks that occur within the string. Hope that gets it for ya...

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default New Spreadsheet Name


Dim Path As String
Path=""C:\Documents and Settings\Richard Sabbara\Desktop\

With ActiveWorkbook
.SaveAs Filename:=Path & .Worksheets("WhichSheet").Range("C1").Value &
".xls", _
FileFormat:=xlNormal, _
Password:="", _
WriteResPassword:="", _
ReadOnlyRecommended:=False, _
CreateBackup:=False

Obviously change 'WhichSheet" to worksheet in question.

NickHK

wrote in message
oups.com...
I have a list of doctors that I need to create templates for and then
refresh the background query (the spreadsheet is linked to SQL) . I
have the logic worked out, the only problem that I am having is that
when it comes to saving the file name, I have the doctors name in Cell
A5, this is a dynmic field based on the query, how I do fix the
following line of code to tell it to look at A5 for the file name? I
thought I would be able to copy from cell A5 and paste it into the file
name, but that is not working, any other suggestions?

The line of code to save the workbook is:

ActiveWorkbook.SaveAs Filename:= _
"C:\Documents and Settings\Richard
Sabbara\Desktop\Range('C1')", FileFormat _
:=xlNormal, Password:="", WriteResPassword:="",
ReadOnlyRecommended:= _
False, CreateBackup:=False

Any help is greatly appericated.

Richard



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
link a local spreadsheet to a network shared spreadsheet Leo Setting up and Configuration of Excel 1 March 21st 08 10:37 AM
Transmitting data from a server spreadsheet to a client spreadsheet gloryofbach Excel Programming 3 October 27th 05 11:23 AM
conversion of MS Works Spreadsheet to Excel 2002 Spreadsheet Kellie Excel Discussion (Misc queries) 1 March 24th 05 06:31 PM
Is there a way to insert a formula, password or macro in an excel spreadsheet that will automatically delete the spreadsheet? oil_driller Excel Discussion (Misc queries) 1 February 8th 05 09:34 AM
How to open another Excel spreadsheet to copy data into current spreadsheet ? Ricky Pang Excel Programming 0 July 13th 03 01:59 PM


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