Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 7
Default Save to a location other than default

I've created a button to save a file with a name created from a cell, but I
need to be able to save it to a particular location which is other than the
default location.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,276
Default Save to a location other than default

Hi,

ActiveWorkbook.Save
ActiveWorkbook.SaveAs Filename:= _
"N:\2009 Uploads\GLL\GLL 2009 TB.xls", FileFormat:=xlExcel8,
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
, CreateBackup:=False

Change the directory and name to fit your needs just need to change this
N:\2009 Uploads\GLL\GLL 2009 TB.xls

if this helps please click yes, thanks

"RMires" wrote:

I've created a button to save a file with a name created from a cell, but I
need to be able to save it to a particular location which is other than the
default location.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 7
Default Save to a location other than default

It helps, but it's not quite that simple. I am also changing the file name at
the same time. I'm not quite sure how to connect the file location
"W:\Hebert\Operations" with the code that creates the file name
..Worksheets("OPENING STK").Range("b20").Value & ".xls"


"Eduardo" wrote:

Hi,

ActiveWorkbook.Save
ActiveWorkbook.SaveAs Filename:= _
"N:\2009 Uploads\GLL\GLL 2009 TB.xls", FileFormat:=xlExcel8,
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
, CreateBackup:=False

Change the directory and name to fit your needs just need to change this
N:\2009 Uploads\GLL\GLL 2009 TB.xls

if this helps please click yes, thanks

"RMires" wrote:

I've created a button to save a file with a name created from a cell, but I
need to be able to save it to a particular location which is other than the
default location.

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Save to a location other than default


dim myFileName as string

with activeworkbook
myfilename = "W:\Hebert\Operations\" _
& .Worksheets("OPENING STK").Range("b20").Value & ".xls"

.saveas filename:=myfilename, FileFormat:=xlWorkbookNormal
end with



RMires wrote:

It helps, but it's not quite that simple. I am also changing the file name at
the same time. I'm not quite sure how to connect the file location
"W:\Hebert\Operations" with the code that creates the file name
.Worksheets("OPENING STK").Range("b20").Value & ".xls"

"Eduardo" wrote:

Hi,

ActiveWorkbook.Save
ActiveWorkbook.SaveAs Filename:= _
"N:\2009 Uploads\GLL\GLL 2009 TB.xls", FileFormat:=xlExcel8,
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
, CreateBackup:=False

Change the directory and name to fit your needs just need to change this
N:\2009 Uploads\GLL\GLL 2009 TB.xls

if this helps please click yes, thanks

"RMires" wrote:

I've created a button to save a file with a name created from a cell, but I
need to be able to save it to a particular location which is other than the
default location.


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 7,247
Default Save to a location other than default

Try something like the following:


Sub AAA()
Dim FolderName As String
Dim FileName As String
Dim FullName As String

FolderName = "C:\Test\" '<<< CHANGE
FileName = Worksheets("Sheet1").Range("A1").Text '<< CHANGE
If InStr(1, FileName, ".xls") = 0 Then
' add the XLS extension if it is not present
FileName = FileName & ".xls"
End If
If StrComp(Right(FolderName, 1), "\", vbBinaryCompare) < 0 Then
' add trailing slash to folder if not present.
FolderName = FolderName & "\"
End If
FullName = FolderName & FileName
ThisWorkbook.SaveAs FullName
End Sub


Change the lines marked with <<< CHANGE to the appropriate values. The
code will save the workbook using the name in cell A1 in the folder
"C:\Test". If the filename in A1 does not end in ".xls", that will be
appended to the file name.

If you have the folder in which the file should be saved in some cell,
change

FolderName = "C:\Test\"
' to something like
FolderName = Worksheets("Sheet1").Range("C1").Text

If you want to prompt the user to select a folder, download the
modBrowseFolder.bas module at
http://www.cpearson.com/Excel/BrowseFolder.aspx . Then, do something
like

FolderName = BrowseFolder()
If FolderName = vbNullString Then
' user cancelled. get out.
Exit Sub
End If


Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)


On Wed, 3 Jun 2009 11:35:01 -0700, RMires
wrote:

I've created a button to save a file with a name created from a cell, but I
need to be able to save it to a particular location which is other than the
default location.



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 7
Default Save to a location other than default

What does the underscore do?

"Dave Peterson" wrote:


dim myFileName as string

with activeworkbook
myfilename = "W:\Hebert\Operations\" _
& .Worksheets("OPENING STK").Range("b20").Value & ".xls"

.saveas filename:=myfilename, FileFormat:=xlWorkbookNormal
end with



RMires wrote:

It helps, but it's not quite that simple. I am also changing the file name at
the same time. I'm not quite sure how to connect the file location
"W:\Hebert\Operations" with the code that creates the file name
.Worksheets("OPENING STK").Range("b20").Value & ".xls"

"Eduardo" wrote:

Hi,

ActiveWorkbook.Save
ActiveWorkbook.SaveAs Filename:= _
"N:\2009 Uploads\GLL\GLL 2009 TB.xls", FileFormat:=xlExcel8,
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
, CreateBackup:=False

Change the directory and name to fit your needs just need to change this
N:\2009 Uploads\GLL\GLL 2009 TB.xls

if this helps please click yes, thanks

"RMires" wrote:

I've created a button to save a file with a name created from a cell, but I
need to be able to save it to a particular location which is other than the
default location.


--

Dave Peterson

  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Save to a location other than default

The space then underscore is the line continuation symbol.

If I hadn't used it, then the line would have been extremely long and your
newsreader may have wrapped in an incorrect location.

RMires wrote:

What does the underscore do?

"Dave Peterson" wrote:


dim myFileName as string

with activeworkbook
myfilename = "W:\Hebert\Operations\" _
& .Worksheets("OPENING STK").Range("b20").Value & ".xls"

.saveas filename:=myfilename, FileFormat:=xlWorkbookNormal
end with



RMires wrote:

It helps, but it's not quite that simple. I am also changing the file name at
the same time. I'm not quite sure how to connect the file location
"W:\Hebert\Operations" with the code that creates the file name
.Worksheets("OPENING STK").Range("b20").Value & ".xls"

"Eduardo" wrote:

Hi,

ActiveWorkbook.Save
ActiveWorkbook.SaveAs Filename:= _
"N:\2009 Uploads\GLL\GLL 2009 TB.xls", FileFormat:=xlExcel8,
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
, CreateBackup:=False

Change the directory and name to fit your needs just need to change this
N:\2009 Uploads\GLL\GLL 2009 TB.xls

if this helps please click yes, thanks

"RMires" wrote:

I've created a button to save a file with a name created from a cell, but I
need to be able to save it to a particular location which is other than the
default location.


--

Dave Peterson


--

Dave Peterson
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
Macro - save to current location vs excel default location leezard Excel Discussion (Misc queries) 0 October 28th 08 03:04 PM
Default save as location in Microsoft Query ngg Excel Discussion (Misc queries) 0 August 8th 08 08:43 PM
default save location on network Steve_n_KC Excel Discussion (Misc queries) 1 August 23rd 07 01:38 AM
Changed Excel 2003 startup now won't save to default location Beach Lover Excel Discussion (Misc queries) 11 June 28th 07 06:27 PM
default file location maryj Excel Discussion (Misc queries) 2 March 3rd 05 06:09 PM


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