A Microsoft Excel forum. ExcelBanter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » ExcelBanter forum » Excel Newsgroups » Excel Programming
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Macro to open SaveAs... and change filename to cell value



 
 
Thread Tools Display Modes
  #1  
Old July 18th 04, 03:04 PM posted to microsoft.public.excel.programming
Andy
external usenet poster
 
Posts: 414
Default Macro to open SaveAs... and change filename to cell value

I have an excel.xlt file that I would like to fill in and save as an .xls with its filename and path based on particular cell values

For example A1 = Company A2 = QuoteNumber

The full Path/filename I would like to SaveAs...
is R:\Company\QuoteNumber.xls

I would appreciate if any could suggest a macro code to do this

Ads
  #2  
Old July 18th 04, 03:26 PM posted to microsoft.public.excel.programming
JulieD
external usenet poster
 
Posts: 618
Default Macro to open SaveAs... and change filename to cell value

Hi Andy

something along the lines of

Dim fname As String
fname = "R:\" & Range("A1").Value & "\" & Range("A2").Value & ".xls"
ActiveWorkbook.SaveAs fname

this assumes that the folder for the company exists

Cheers
JulieD


"Andy" > wrote in message
...
> I have an excel.xlt file that I would like to fill in and save as an .xls

with its filename and path based on particular cell values
>
> For example A1 = Company A2 = QuoteNumber
>
> The full Path/filename I would like to SaveAs...
> is R:\Company\QuoteNumber.xls
>
> I would appreciate if any could suggest a macro code to do this
>



  #3  
Old July 19th 04, 02:47 AM posted to microsoft.public.excel.programming
Andy
external usenet poster
 
Posts: 414
Default Macro to open SaveAs... and change filename to cell value

Thanks Julie

It did exactly what I wanted in terms of the file saving. Thankyou.
What it didn't do was also change the name of the .xlt I was working on. Yes, the file was saved as the correct name however as I would like to keep working on it without opening the correctname.xls.


"JulieD" wrote:

> Hi Andy
>
> something along the lines of
>
> Dim fname As String
> fname = "R:\" & Range("A1").Value & "\" & Range("A2").Value & ".xls"
> ActiveWorkbook.SaveAs fname
>
> this assumes that the folder for the company exists
>
> Cheers
> JulieD
>
>
> "Andy" > wrote in message
> ...
> > I have an excel.xlt file that I would like to fill in and save as an .xls

> with its filename and path based on particular cell values
> >
> > For example A1 = Company A2 = QuoteNumber
> >
> > The full Path/filename I would like to SaveAs...
> > is R:\Company\QuoteNumber.xls
> >
> > I would appreciate if any could suggest a macro code to do this
> >

>
>
>

  #4  
Old July 19th 04, 02:51 AM posted to microsoft.public.excel.programming
Andy
external usenet poster
 
Posts: 414
Default Macro to open SaveAs... and change filename to cell value



"JulieD" wrote:

> Hi Andy
>
> something along the lines of
>
> Dim fname As String
> fname = "R:\" & Range("A1").Value & "\" & Range("A2").Value & ".xls"
> ActiveWorkbook.SaveAs fname
>
> this assumes that the folder for the company exists
>
> Cheers
> JulieD
>
>
> "Andy" > wrote in message
> ...
> > I have an excel.xlt file that I would like to fill in and save as an .xls

> with its filename and path based on particular cell values
> >
> > For example A1 = Company A2 = QuoteNumber
> >
> > The full Path/filename I would like to SaveAs...
> > is R:\Company\QuoteNumber.xls
> >
> > I would appreciate if any could suggest a macro code to do this
> >

>
>
>

  #5  
Old July 19th 04, 02:51 AM posted to microsoft.public.excel.programming
Andy
external usenet poster
 
Posts: 414
Default Macro to open SaveAs... and change filename to cell value

Hi Julie

Thankyou very much. The file save worked well however I wanted to continue working on the new saved as file straight away and had to open the file manually.

When I normally Save As... manually the .xlt I am working on turns into a .xls that I rename and relocate and I continue to work on the .xls.

Is there something I have forgotten?

"JulieD" wrote:

> Hi Andy
>
> something along the lines of
>
> Dim fname As String
> fname = "R:\" & Range("A1").Value & "\" & Range("A2").Value & ".xls"
> ActiveWorkbook.SaveAs fname
>
> this assumes that the folder for the company exists
>
> Cheers
> JulieD
>
>
> "Andy" > wrote in message
> ...
> > I have an excel.xlt file that I would like to fill in and save as an .xls

> with its filename and path based on particular cell values
> >
> > For example A1 = Company A2 = QuoteNumber
> >
> > The full Path/filename I would like to SaveAs...
> > is R:\Company\QuoteNumber.xls
> >
> > I would appreciate if any could suggest a macro code to do this
> >

>
>
>

  #6  
Old July 19th 04, 12:23 PM posted to microsoft.public.excel.programming
JulieD
external usenet poster
 
Posts: 618
Default Macro to open SaveAs... and change filename to cell value

Hi Andy

i don't quite understand this, when i run the code the xlt turns into the
newly saved file (as shown in the title bar at the top) ... this is whether
i open the template itself or whether i open a new workbook based on the
template.

how are you running the code? could you cut & paste everything from the sub
to the end sub -also are you opening the xlt or a new workbook based on the
xlt (file / new - templates from my computer etc)

what version of excel are you running?

Cheers
JulieD

"Andy" > wrote in message
...
> Hi Julie
>
> Thankyou very much. The file save worked well however I wanted to continue

working on the new saved as file straight away and had to open the file
manually.
>
> When I normally Save As... manually the .xlt I am working on turns into a

..xls that I rename and relocate and I continue to work on the .xls.
>
> Is there something I have forgotten?
>
> "JulieD" wrote:
>
> > Hi Andy
> >
> > something along the lines of
> >
> > Dim fname As String
> > fname = "R:\" & Range("A1").Value & "\" & Range("A2").Value & ".xls"
> > ActiveWorkbook.SaveAs fname
> >
> > this assumes that the folder for the company exists
> >
> > Cheers
> > JulieD
> >
> >
> > "Andy" > wrote in message
> > ...
> > > I have an excel.xlt file that I would like to fill in and save as an

..xls
> > with its filename and path based on particular cell values
> > >
> > > For example A1 = Company A2 = QuoteNumber
> > >
> > > The full Path/filename I would like to SaveAs...
> > > is R:\Company\QuoteNumber.xls
> > >
> > > I would appreciate if any could suggest a macro code to do this
> > >

> >
> >
> >



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
SaveAs Filename and FileFormat in Vs2007 RobN[_2_] Excel Discussion (Misc queries) 4 July 14th 07 01:21 AM
SaveAs using two cells for filename David Excel Discussion (Misc queries) 5 June 4th 05 11:46 AM
Max charactors for 'ActiveWorkbook.SaveAs Filename'? TOMB Excel Worksheet Functions 1 February 16th 05 06:44 AM
SaveAs Filename Help Ed[_14_] Excel Programming 2 November 20th 03 07:43 PM
Can a MACRO prompt for the filename to open and/or save? Dave Peterson[_3_] Excel Programming 1 September 3rd 03 04:53 PM


All times are GMT +1. The time now is 04:32 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright 2004-2017 ExcelBanter.
The comments are property of their posters.