Solved

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

Posted on 2015-02-24
2
96 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 34

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

Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

Join & Write a Comment

It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

747 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now