Do not use on any
shared computer
August 30, 2008 01:17am pdt
 
[x]
Attachment Details

How would I modify a routine to have the XLS file display in the foreground when currently the XLS file shows up on the task bar and is minimized ?

I am developing an Access application using Access as the front end and SQL Server as the back end databse. I am using a combination of Access and Excel VBA.

In the attached code snippet, I generate an Excel file named ACSWMVF_05062008.XLS but the Excel file shows up on the task bar (minimized) and I would like for it to show up in the foreground.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
Private Sub ACSWITHMVFToExcel()
    ExportedFile = "\\nydfs1\root\lib\CONTROLLERS\IIG\CASH_CONTROL\ccshared\AbandonedProperty\UDL\Access\Reconcile\UDL.ACSWMVF.TALLINT1.TALLINT1" & "." & intYearSP & "." & Format(Now, "mmddhhnnss") & ".ARD.OUT.XLS"
    DoCmd.TransferSpreadsheet acExport, 8, "dbo.tblFlACSMV", ExportedFile, True, ""
       
    If isFileExist(ExportedFile) Then StartACSWMV ExportedFile
       
    strFile1 = Left(ExportedFile, Len(ExportedFile) - 4)
    FileCopy ExportedFile, strFile1
   
    strFile = Left(ExportedFile, Len(ExportedFile) - 8)
    intFile = VBA.FreeFile
    Open strFile For Append Access Write Lock Write As #intFile
    Close #intFile
      
    strFile2 = Right(strFile1, Len(strFile1) - 95)
      
    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, "COMMENT:--------------Xcel Report load-------------------"
    Print #intFile, "GROUP_FIELD_NAME:REPTID"
    Print #intFile, "GROUP_FIELD_VALUE:ACSWMVF"
    Print #intFile, "GROUP_FIELD_NAME:REPTYR"
    Print #intFile, "GROUP_FIELD_VALUE:" & intYearSP
    Print #intFile, "GROUP_FIELD_NAME:ReportDate"
    Print #intFile, "GROUP_FIELD_VALUE:" & Format(Now, "mm/dd/yyyy")
    Print #intFile, "GROUP_OFFSET:0"
    Print #intFile, "GROUP_LENGTH:0"
    Print #intFile, "GROUP_FILENAME:/clientdoc/" & strFile2
    Close #intFile
      
    Beep
    MsgBox "ACS With MV Fall Report has been sent to On Demand", vbOKOnly, ""
     
    FileCopy ExportedFile, "\\nydfs1\root\lib\CONTROLLERS\IIG\CASH_CONTROL\ccshared\AbandonedProperty\UDL\Access\Reconcile\ACSWMVF_" & Format(Now(), "MMDDYYYY") & ".XLS"
    Shell "EXCEL.EXE" & " " & "\\nydfs1\root\lib\CONTROLLERS\IIG\CASH_CONTROL\ccshared\AbandonedProperty\UDL\Access\Reconcile\ACSWMVF_" & Format(Now(), "MMDDYYYY") & ".XLS"        
End Sub
 
 
Private Sub StartACSWMV(filename)
 Set xlApp = New Excel.Application
 Set xlWB = xlApp.Workbooks.Open(filename)
 Set xlWS = xlWB.Worksheets(1)
 xlWS.Columns.AutoFit
 xlWS.Range("W2:W65535").NumberFormat = "#,##0.00"
 xlWS.Range("X2:X65535").NumberFormat = "#,##0.000"
 xlWS.Range("AE2:AE65535").NumberFormat = "#,##0.00"
 xlWS.Rows("1:2").Insert Shift:=xlDown
 xlWS.Range("A1") = "UDL ACS With MV Report For " & Format(Now(), "MM/DD/YYYY")
 xlWB.Close True
 Set xlWB = Nothing
 xlApp.Quit
End Sub
Start your free trial to view this solution
[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!

Question Stats
Zone: Software
Question Asked By: zimmer9
Solution Provided By: ahammar
Participating Experts: 1
Solution Grade: A
Views: 0
Translate:
Loading Advertisement...
 
[+][-]Accepted Solution by ahammar

Rank: Sage

Accepted Solution by ahammar:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
Open Discussion
Open Discussion
 
Comment by ahammar
Thanks for the points and the grade!  I'm glad it solved your problem...

:-)
Albert
 
 
20080723-EE-VQP-34 / EE_QW_2_20070628