Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Tel Tel is offline
external usenet poster
 
Posts: 39
Default Allowing user to choose to accept saveas option

I've managed to create the "saveas Macro using cell contents".
However, it automatically saves it to my documents.

Here's my code

Sub save_it()
Dim fname
With ActiveWorkbook
fname = "VMRP_" & .Worksheets("TEST").Range("A1").Value & "_" &
..Worksheets("sheet2").Range("B3").Value & ".xls"
..SaveAs fname
End With
End Sub

Is it possible to insert a break which brings up the saveas dialog box and
enables the user to change the filename (possibly to match their naming
protocols and conventions and pick the location where they would store it?

Many thanks

Terry

  #3   Report Post  
Posted to microsoft.public.excel.misc
Tel Tel is offline
external usenet poster
 
Posts: 39
Default Allowing user to choose to accept saveas option

Sorry for that Don, I looked at the date in April and wasn't sure whether it
would appear near the top of the list. I thought the listing was arranged in
date order of original post.

Apologies if I've done something wrong or against protocol. That wasn't my
intent.

:-(

Tel

"Don Guillett" wrote:

Why are you posting the same question with a different name 13 minutes
later?

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Tel" wrote in message
...
I've managed to create the "saveas Macro using cell contents".
However, it automatically saves it to my documents.

Here's my code

Sub save_it()
Dim fname
With ActiveWorkbook
fname = "VMRP_" & .Worksheets("TEST").Range("A1").Value & "_" &
.Worksheets("sheet2").Range("B3").Value & ".xls"
.SaveAs fname
End With
End Sub

Is it possible to insert a break which brings up the saveas dialog box and
enables the user to change the filename (possibly to match their naming
protocols and conventions and pick the location where they would store it?

Many thanks

Terry



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,346
Default Allowing user to choose to accept saveas option

I suppose your other post got an answer but I don't want to waste the time
looking so

Application.GetSaveAsFilename()

GetSaveAsFilename Method
See AlsoApplies ToExampleSpecificsDisplays the standard Save As dialog box
and gets a file name from the user without actually saving any files.

expression.GetSaveAsFilename(InitialFilename, FileFilter, FilterIndex,
Title, ButtonText)
expression Required. An expression that returns an Application object.

InitialFilename Optional Variant. Specifies the suggested file name. If
this argument is omitted, Microsoft Excel uses the active workbook's name.

FileFilter Optional Variant. A string specifying file filtering criteria.

This string consists of pairs of file filter strings followed by the MS-DOS
wildcard file filter specification, with each part and each pair separated by
commas. Each separate pair is listed in the Files of type drop-down list box.
For example, the following string specifies two file filters, text and addin:
"Text Files (*.txt), *.txt, Add-In Files (*.xla), *.xla".

To use multiple MS-DOS wildcard expressions for a single file filter type,
separate the wildcard expressions with semicolons; for example, "Visual Basic
Files (*.bas; *.txt),*.bas;*.txt".

If omitted, this argument defaults to "All Files (*.*),*.*".

FilterIndex Optional Variant. Specifies the index number of the default
file filtering criteria, from 1 to the number of filters specified in
FileFilter. If this argument is omitted or greater than the number of filters
present, the first file filter is used.

Title Optional Variant. Specifies the title of the dialog box. If this
argument is omitted, the default title is used.

ButtonText Optional Variant. Macintosh only.

Remarks
This method returns the selected file name or the name entered by the user.
The returned name may include a path specification. Returns False if the user
cancels the dialog box.

This method may change the current drive or folder.

Example
This example displays the Save As dialog box, with the file filter set to
text files. If the user chooses a file name, the example displays that file
name in a message box.

fileSaveName = Application.GetSaveAsFilename( _
fileFilter:="Text Files (*.txt), *.txt")
If fileSaveName < False Then
MsgBox "Save as " & fileSaveName
End If



--
If this helps, please click the Yes button.

Cheers,
Shane Devenshire


"Tel" wrote:

I've managed to create the "saveas Macro using cell contents".
However, it automatically saves it to my documents.

Here's my code

Sub save_it()
Dim fname
With ActiveWorkbook
fname = "VMRP_" & .Worksheets("TEST").Range("A1").Value & "_" &
.Worksheets("sheet2").Range("B3").Value & ".xls"
.SaveAs fname
End With
End Sub

Is it possible to insert a break which brings up the saveas dialog box and
enables the user to change the filename (possibly to match their naming
protocols and conventions and pick the location where they would store it?

Many thanks

Terry

  #5   Report Post  
Posted to microsoft.public.excel.misc
Tel Tel is offline
external usenet poster
 
Posts: 39
Default Allowing user to choose to accept saveas option

Thanks for your help guys. I've managed to get a solution which, for the
benefit of others, looks like this:

Sub save_it()
Dim fname
With ActiveWorkbook
Application.Dialogs(xlDialogSaveAs).Show "ABCD_" &
Format(.Worksheets("Remediation Plan").Range("F2").Value, "yymmdd-hhmm") &
"_" & .Worksheets("Remediation Plan").Range("C2").Value & ".xls"

End With
End Sub

I've picked the date value as yymmdd-hhmm as it's probably easiest for
filing.

Cell F2 is the date (evidently)
Cell C2 is the company name of the user that's completing the form.

No doubt I'll be back for other stuff.

Tel

"Tel" wrote:

I've managed to create the "saveas Macro using cell contents".
However, it automatically saves it to my documents.

Here's my code

Sub save_it()
Dim fname
With ActiveWorkbook
fname = "VMRP_" & .Worksheets("TEST").Range("A1").Value & "_" &
.Worksheets("sheet2").Range("B3").Value & ".xls"
.SaveAs fname
End With
End Sub

Is it possible to insert a break which brings up the saveas dialog box and
enables the user to change the filename (possibly to match their naming
protocols and conventions and pick the location where they would store it?

Many thanks

Terry

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
Locking a worksheet, but allowing user to add rows in a table Ray Carter Excel Worksheet Functions 2 September 24th 08 11:51 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
Excel 2007 - Where is the Accept Labels in Formulas Option? headly Excel Discussion (Misc queries) 3 June 8th 07 12:58 PM
Allowing user to merge cells Lavanya Excel Discussion (Misc queries) 1 November 23rd 06 05:47 AM
Unshared workbook allowing write access to more than 1 user [email protected] Excel Discussion (Misc queries) 0 August 2nd 06 03:14 PM


All times are GMT +1. The time now is 03:19 PM.

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"