There may be times when you need to ask the user to select a location to save a file. This can be done using a save file dialog. Keep in mind. Morning All, I have a macro that modifies a standard template. At the end of this macro I want a save as dialogue that opens up in a default. Trying to set filename to cell A1 Value, but this does not work. what am I doing wrong please. TY Sub Move_Copy_Save() Dim varResult As.

Author: Akinoktilar Zule
Country: Costa Rica
Language: English (Spanish)
Genre: Science
Published (Last): 2 July 2004
Pages: 174
PDF File Size: 18.25 Mb
ePub File Size: 11.19 Mb
ISBN: 716-8-66738-420-4
Downloads: 46219
Price: Free* [*Free Regsitration Required]
Uploader: Zoloshicage

Any ideas why this is happening to me? FilterIndex Optional Variant Specifies the index number of the default file filtering criteria, from 1 to the number of filters specified in FileFilter.

Try like this Code:. However, it turns out that if the filterindex setting does not exactly match the filetype as the workbook currently has, then the ActiveWorkbook. Highlight your code and click the icon at the top of your post window. Posting code between tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

Just like with GetOpenFilename, you can test whether the result equals False to determine if the user clicked the Cancel button. Title Optional Variant Specifies the title of the dialog box.


The problem I came across was a type mismatch while checking if the user clicked on Cancel when he did not do that. For Each rRow In Sheet1.

This method may gdtsaveasfilename the current drive or folder. By clicking “Post Your Answer”, you acknowledge that you have read our updated terms of serviceprivacy policy and cookie policyand that your continued use of the website is subject to these policies. As you can see this time the.

If this argument is omitted, the default title is getssveasfilename. There the Getsaveastilename is a bit translated, thus the saveName is translated to Falsch and not False as in the rest of the world. Login or Sign Up. Last edited by Artik; at Trying to set filename to cell A1 Value, but this does not work.

Return value Variant Remarks This string passed in the FileFilter argument 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.

Programming Excel with VBA and .NET by Steve Saunders, Jeff Webb

I need to do this because the pivot is querying information within the workbook using SQL. Using the GetSaveAsFilename dialog box, is not a save function, it is used to get the string you want to save as, you will still have to use a saveas line to complete the action. Hit the S ave button and you think all is done. Stack Overflow works best with JavaScript enabled.


eAsFilename Help – Free Excel\VBA Help Forum

Thanks for the help. The code below runs fine, BUT, it isn’t actually saving the file.

Easy to get working and modify to suit my individual needs. It will only provide the full path the user has selected to save the file:.

As you’ve declared SaveName as a string, you need to check for “False”not False. Read about this change in our blog post. Sometime you might want to give the user the option to choose the file extension from multiple available extensions. There was a problem with Example 1. XLSM if you want to save in an Excel file format.

Leave this field empty. I’ve been thinking, to use ActiveWorkbook.

If so how do i go about checking if a file exsists? To use multiple MS-DOS wildcard expressions for a single file filter type, separate the wildcard expressions with semicolons; for example, “Visual Basic Files. Ozgrid is Not Associated With Microsoft. You may have to register before you can post: The macro cannot be run.

Use code tags around code. Interesting…I amended this code so that instead of the filename being blank, it returns the ActiveWorkbook.