Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 72
Default Allowing the user to specify save location

Easy question I'm sure.....

How do I write code to save a file as the name in cell C2 but also allow the
user to define the location (path) of the file?

What I would like is the same as the window that pops up when you select
File Save As in Excel. If I could get the file name to default (from cell
C2) and then have the user take it from there to save to the location they
want.

How can I get there?

I currently have the code below:

Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:=Range("C2").Value
Application.DisplayAlerts = True
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Allowing the user to specify save location

Tim,
You mean like this ?

Private Sub CommandButton3_Click()
Dim RetVal As Variant
RetVal = Application.GetSaveAsFilename(Range("C2"))
If RetVal < False Then
ThisWorkbook.SaveAs RetVal
End If
End Sub

NickHK

"TimN" ...
Easy question I'm sure.....

How do I write code to save a file as the name in cell C2 but also allow
the
user to define the location (path) of the file?

What I would like is the same as the window that pops up when you select
File Save As in Excel. If I could get the file name to default (from
cell
C2) and then have the user take it from there to save to the location they
want.

How can I get there?

I currently have the code below:

Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:=Range("C2").Value
Application.DisplayAlerts = True



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 644
Default Allowing the user to specify save location

Tim, try this:
Sub FolderPicker()
Dim SvPath As String
With Application.FileDialog(msoFileDialogFolderPicker)
.AllowMultiSelect = False
If .Show = False Then Exit Sub
SvPath = .SelectedItems(1)
End With
ActiveWorkbook.SaveAs SvPath & Range("C1")
End Sub

Charles
News wrote:
Tim,
You mean like this ?

Private Sub CommandButton3_Click()
Dim RetVal As Variant
RetVal = Application.GetSaveAsFilename(Range("C2"))
If RetVal < False Then
ThisWorkbook.SaveAs RetVal
End If
End Sub

NickHK

"TimN" ...
Easy question I'm sure.....

How do I write code to save a file as the name in cell C2 but also allow
the
user to define the location (path) of the file?

What I would like is the same as the window that pops up when you select
File Save As in Excel. If I could get the file name to default (from
cell
C2) and then have the user take it from there to save to the location they
want.

How can I get there?

I currently have the code below:

Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:=Range("C2").Value
Application.DisplayAlerts = True


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 72
Default Allowing the user to specify save location

Thanks to both of you. These worked great! One question just out of
curiosity. When I do the save, it saves the file as a file type "File"
rather than an excel worksheet (.xls). What is file type "file"?

"Die_Another_Day" wrote:

Tim, try this:
Sub FolderPicker()
Dim SvPath As String
With Application.FileDialog(msoFileDialogFolderPicker)
.AllowMultiSelect = False
If .Show = False Then Exit Sub
SvPath = .SelectedItems(1)
End With
ActiveWorkbook.SaveAs SvPath & Range("C1")
End Sub

Charles
News wrote:
Tim,
You mean like this ?

Private Sub CommandButton3_Click()
Dim RetVal As Variant
RetVal = Application.GetSaveAsFilename(Range("C2"))
If RetVal < False Then
ThisWorkbook.SaveAs RetVal
End If
End Sub

NickHK

"TimN" ...
Easy question I'm sure.....

How do I write code to save a file as the name in cell C2 but also allow
the
user to define the location (path) of the file?

What I would like is the same as the window that pops up when you select
File Save As in Excel. If I could get the file name to default (from
cell
C2) and then have the user take it from there to save to the location they
want.

How can I get there?

I currently have the code below:

Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:=Range("C2").Value
Application.DisplayAlerts = True



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 644
Default Allowing the user to specify save location

Try:
ActiveWorkbook.SaveAs Filename:= _
SvPath & Range("C1"), _
FileFormat:=xlNormal

Let me know if that fixes things.

Charles

TimN wrote:
Thanks to both of you. These worked great! One question just out of
curiosity. When I do the save, it saves the file as a file type "File"
rather than an excel worksheet (.xls). What is file type "file"?

"Die_Another_Day" wrote:

Tim, try this:
Sub FolderPicker()
Dim SvPath As String
With Application.FileDialog(msoFileDialogFolderPicker)
.AllowMultiSelect = False
If .Show = False Then Exit Sub
SvPath = .SelectedItems(1)
End With
ActiveWorkbook.SaveAs SvPath & Range("C1")
End Sub

Charles
News wrote:
Tim,
You mean like this ?

Private Sub CommandButton3_Click()
Dim RetVal As Variant
RetVal = Application.GetSaveAsFilename(Range("C2"))
If RetVal < False Then
ThisWorkbook.SaveAs RetVal
End If
End Sub

NickHK

"TimN" ...
Easy question I'm sure.....

How do I write code to save a file as the name in cell C2 but also allow
the
user to define the location (path) of the file?

What I would like is the same as the window that pops up when you select
File Save As in Excel. If I could get the file name to default (from
cell
C2) and then have the user take it from there to save to the location they
want.

How can I get there?

I currently have the code below:

Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:=Range("C2").Value
Application.DisplayAlerts = True






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Allowing the user to specify save location

Which format was was the original file in and how do you .SaveAs ?

NickHK

"TimN" ...
Thanks to both of you. These worked great! One question just out of
curiosity. When I do the save, it saves the file as a file type "File"
rather than an excel worksheet (.xls). What is file type "file"?

"Die_Another_Day" wrote:

Tim, try this:
Sub FolderPicker()
Dim SvPath As String
With Application.FileDialog(msoFileDialogFolderPicker)
.AllowMultiSelect = False
If .Show = False Then Exit Sub
SvPath = .SelectedItems(1)
End With
ActiveWorkbook.SaveAs SvPath & Range("C1")
End Sub

Charles
News wrote:
Tim,
You mean like this ?

Private Sub CommandButton3_Click()
Dim RetVal As Variant
RetVal = Application.GetSaveAsFilename(Range("C2"))
If RetVal < False Then
ThisWorkbook.SaveAs RetVal
End If
End Sub

NickHK

"TimN" ...

Easy question I'm sure.....

How do I write code to save a file as the name in cell C2 but also
allow
the
user to define the location (path) of the file?

What I would like is the same as the window that pops up when you
select
File Save As in Excel. If I could get the file name to default
(from
cell
C2) and then have the user take it from there to save to the location
they
want.

How can I get there?

I currently have the code below:

Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:=Range("C2").Value
Application.DisplayAlerts = True





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
How do I protect a number of sheets allowing the user to add a com Prashanth KR New Users to Excel 8 August 28th 07 04:06 PM
Allowing user to merge cells Lavanya Excel Discussion (Misc queries) 1 November 23rd 06 05:47 AM
Allowing User to save file Jordan Excel Programming 5 April 27th 06 07:24 PM
allowing user to format a protected cell Andrew[_44_] Excel Programming 1 May 28th 04 06:56 AM


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