Solved

How to get an excel file to OPEN without saving it somewhere

Posted on 2015-02-24
2
103 Views
Last Modified: 2015-03-05
I have this code and I want the Excel file to just open and not output it to somewhere.  How do I change my code to do that?


Private Sub cmdExport_ALLORGS_Click()
'On Error GoTo Err_cmdExport_ALLORGS_Click

 Dim username As String, stDocName As String, stFilename As String
 
    If MsgBox("Click YES to export all Allotments to Excel, NO to export current Allotment.", vbYesNo, "Export Options") = vbYes Then
        'stDocName = "QryRecapTest_ExcelOutputALL"
    Else
        stDocName = "Copy of Allot_Q"
    End If
    

    
        
        DoCmd.OutputTo acOutputQuery, "Copy Of Allot_Q", "Excel97-Excel2003Workbook(*.xls)", "", True, "", , acExportQualityScreen
   
'Exit_cmdExport_ALLORGS_Click:
 '   Exit Sub

'Err_cmdExport_ALLORGS_Click:
 '   MsgBox Err.Description
  '  Resume Exit_cmdExport_ALLORGS_Click
    

End Sub

Open in new window

0
Comment
Question by:Jass Saini
2 Comments
 
LVL 35

Accepted Solution

by:
PatHartman earned 500 total points
ID: 40629006
I'm not going to write the code but you would need to use automation to Open Excel, create a new workbook, make it visible, and populate the rows.

Then the user would need to save it if he wanted to.

But the question is why?  What is wrong with simply using one line of code - TransferSpreadsheet to create the file?
0
 

Author Comment

by:Jass Saini
ID: 40629022
i could use the TransferSpreadSheet ...thank You
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question