473,394 Members | 1,867 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

How do I open the "Save As" window when I export my data from Access to Excel?

12
Hi,

I'm trying to map an export function to a command button to my Access form (called Results). However, I would like it so that the "Save As" window appears when I try to export the table so that the user can select where they want to save the spreadsheet.

The VBA code forces you to extract to a certain place, which isn't practical for my data's intended use. I've tried using a macro but that automatically saves the data to "My Documents", which again is not fit for purpose.

Could anyone let me know how I get the "Save As" window to appear when I press the 'Export' command button please?

Thanks

Sunny
Feb 17 '11 #1
5 5290
MikeTheBike
639 Expert 512MB
Hi

You could use something like this
Expand|Select|Wrap|Line Numbers
  1.     With Application.FileDialog(msoFileDialogFilePicker)
  2.         .Title = strTitle
  3.         If strInitialPath = "" Then
  4.             .InitialFileName = "M:\"
  5.         Else
  6.             .InitialFileName = strInitialPath
  7.         End If
  8.         .AllowMultiSelect = False
  9.         .Filters.Clear
  10.         .Filters.Add FilterText, strFilter, 1
  11.         If .Show Then
  12.             strFileName = .SelectedItems(1)
  13.  
  14.             FileName = Mid(strFileName, InStrRev(strFileName, "\") + 1)
  15.  
  16.             GetFileNameOK = True
  17.         End If
  18.     End With
This is obvoiusly an extract of code for a specific App, but more info is avaialble in Access help for the FileDialog() function, or post back if more specific info required.

Hope that is the sort of thing you want?

MTB
Feb 17 '11 #2
ADezii
8,834 Expert 8TB
@Jinzuku - I'm actually putting together some very nice Code for you from Microsoft, that will enable you to use the 'Official' Windows Save As Dialog Box. The great part of this Code is that everything is encapsulated in a single Class Module, along with minimal Code in the Click() Event of a Command Button. I'll make it available to you as an Attachment sometime tomorrow.
Feb 18 '11 #3
ADezii
8,834 Expert 8TB
As promised, attached please find the Standard Window's Save As Dialog Box with complete functionality. I feel as though this would give any Application that 'Professional' look. There are several Parameters that you can customize to your own specific needs. I have indicated all these areas in the Code by the [UD] Marker. Simply perform a Search in any Code Window for the 'Current Project' for the String [UD], and these areas for customization will appear. Any questions, feel free to ask.
Attached Files
File Type: zip SaveAs.zip (19.0 KB, 461 views)
Feb 18 '11 #4
Jinzuku
12
Excellent, thanks for that ADezii.

I did have to think twice about which button i wanted to press :)
Feb 18 '11 #5
ADezii
8,834 Expert 8TB
I did have to think twice about which button i wanted to press
Just a stupid, immature little thing that I do for all Demos! (LOL).
Feb 18 '11 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: W.Guerlich | last post by:
I've got a Java servlet that delivers large database resultsets transformed to Excel with the HSSF library. In some cases it takes more than 15 minutes before transformation is done and content can...
27
by: Curious Angel | last post by:
I have a resume in PDF format and I want anyone who LEFT-OR-RIGHT clicks the link to force the file to be saved, and in any event _not_ opened. Since the PDF will be in his cache in any event, I...
8
by: dave | last post by:
Hi there I'm trying to force save as dialogue using this code in download.asp..but when it runs it prompts for download.asp to save or open. code snippet (from aspfaq.com) ...
4
by: Richard | last post by:
Hi I'm new to ASP/Web programming so any help would be appreciated... Situation: On my web page I would like to present a link {or button} that would allow the user to download a large file. ...
1
by: Siu | last post by:
Hi, is it possibile to change the format of a file by coding (in the codebehind) the function "Save As..." ?? My aim is to change a html file which is visible in Excel, into a .xls file by coding...
3
by: B-Dog | last post by:
I'm checking some files to see if the filenames are in a certain format and if not I want to pull up a dialog box that gives me a save as with the file that is in question. I have all the files in...
0
by: johnb41 | last post by:
The heart of my application is a database (MS Jet, SQL, etc.). The user needs a connection to this database before he/she can do anything w/ the program. The user will also work with supplimental...
1
by: Tomas Martinez | last post by:
Hi, In my web I have a proccess of download reports which on first step generates a PDF, then flushes the buffer (the generated file) and finally deletes this file from server. Ok, the problem...
60
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I prompt a "Save As" dialog for an accepted mime type?...
0
by: vbnewbie07 | last post by:
Please help - I have developed an excel spreadsheet that has Private Subs that run code based on combo box changes. The problem I am having is that when a user performs a "SAVE AS" the visual basic...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.