Advertisement

07.20.2007 at 10:43AM PDT, ID: 22710271
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.2

How to prevent an Excel file that gets created from displaying on the screen ?

Asked by zimmer9 in Microsoft ADP

Tags: , , ,

I am using Access to develop an Application using Access as the front end and SQL Server as the back end database. In the following VBA code, I export an Access table to Excel and the application opens the Excel file.

As part of the process, a subroutine named StartMetrics is called to modify the spreadsheet to format some columns.

Is there a way to modify this code to have the Excel file just get created WITHOUT opening the Excel file
on the screen ?


ExportedFile = "\\nydfs1\root\lib\CONTROLLERS\IIG\CASH_CONTROL\ccshared\AbandonedProperty\UDL\Access\Reconcile\UDL.METRICS.TALLINT1.TALLINT1" & "." & intYearSP & "." & Format(Now, "mmddhhnnss") & ".ARD.OUT.XLS"
    DoCmd.TransferSpreadsheet acExport, 8, "dbo.tblUDLMetrics", ExportedFile, True, ""
   
   
    If isFileExist(ExportedFile) Then StartMetrics ExportedFile
   
    strFile = Left(ExportedFile, Len(ExportedFile) - 4)
    FileCopy ExportedFile, strFile
   
    strFile = Left(ExportedFile, Len(ExportedFile) - 8)
    intFile = VBA.FreeFile
    Open strFile For Append Access Write Lock Write As #intFile
    Close #intFile
     
    strFile = Left(ExportedFile, Len(ExportedFile) - 8) & ".IND"
    intFile = VBA.FreeFile
    Open strFile For Append Access Write Lock Write As #intFile
    Print #intFile, "CODEPAGE:850"
    Print #intFile, "GROUP_FIELD_NAME:REPTID"
    Close #intFile
     
    Beep
    MsgBox "UDL Metrics has been exported to Excel", vbOKOnly, ""
     
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set ts = fso.CreateTextFile(Replace(ExportedFile, ".XLS", ".TXT"), True)
    ts.Close
    Set ts = Nothing
    Set fso = Nothing
   
    DoCmd.Hourglass False
------------------------------------------

Private Sub StartMetrics(filename)
 Dim xlApp As Excel.Application
 Dim xlWB As Excel.Workbook
 Dim xlWS As Excel.Worksheet

 'open excel template
 Set xlApp = New Excel.Application
 xlApp.Visible = True
 Set xlWB = xlApp.Workbooks.Open(filename)
 Set xlWS = xlWB.Worksheets(1)
 xlWS.Columns.AutoFit
 xlWS.Range("B2:B65535").NumberFormat = "#,##0"
 xlWS.Range("C2:C65535").NumberFormat = "#,##0.00"
 xlWS.Range("C2:C65535").Value = xlWS.Range("C2:C65535").Value
 xlWS.Rows("1:2").Insert Shift:=xlDown
 xlWS.Range("A1") = "UDL Metrics Report For the Month Ending " & Format(DateSerial(Year(Now()), Month(Now()), 1) - 1, "MM/DD/YYYY")
 xlApp.ScreenUpdating = True
End SubStart Free Trial
[+][-]07.20.2007 at 10:50AM PDT, ID: 19533412

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Microsoft ADP
Tags: excel, file, prevent, how
Sign Up Now!
Solution Provided By: stevbe
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20081112-EE-VQP-44