Results 1 to 3 of 3
  1. #1
    jfgrenier is offline Novice
    Windows 7 32bit Access 2003
    Join Date
    Nov 2011
    Posts
    2

    Excel automation (open minimized)

    When 'xls.visible = true' code is used, the excel window can only be seen in the task bar minimized. The rest of the code execute normally without error. Tried a couple API tricks to get excel to show up with no luck. Been automating excel for report a long time with the piece of code bellow with success with Access 2002. Now using Access 2003. Hoping someone saw this before...

    Private Sub cmd_GoExcel_Click()
    Call MakeReport
    End Sub

    Private Sub MakeReport()
    Dim xls As Excel.Application
    Set xls = CreateObject("Excel.Application")
    With xls
    .Workbooks.Add
    .Visible = True

    .Range(.Cells(1, 2), .Cells(1, 8)).Select
    With .Selection
    .MergeCells = True
    .HorizontalAlignment = xlCenter


    .VerticalAlignment = xlCenter
    .Font.Name = "Arial"
    .Font.Size = 14
    .Font.Bold = True
    End With
    .ActiveCell.Value = "2011-2012 DGSSPE"
    End With
    End Sub

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Why are you using Excel to report data? Why not Access report?

    Sorry, I no longer have Access 2003 available but the code worked perfectly with Access 2010.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    jfgrenier is offline Novice
    Windows 7 32bit Access 2003
    Join Date
    Nov 2011
    Posts
    2
    Where I work, some report need special layout (grid style, colum merge). Excel is the perfect tool.

    Manage to get around my problem last night with not so elegant code...

    Set xls = CreateObject("Excel.Application")
    DoEvents
    xls.ScreenUpdating = False
    xls.Application.WindowState = xlMinimized
    xls.Application.WindowState = xlMaximized
    xls.ScreenUpdating = True

    With xls
    .Workbooks.Add
    ...
    ...

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Excel code not working with Excel open
    By jgelpi16 in forum Programming
    Replies: 1
    Last Post: 07-11-2011, 12:12 PM
  2. Excel Automation Select Range Only with Data
    By orcinus in forum Programming
    Replies: 3
    Last Post: 02-09-2011, 01:03 PM
  3. Excel Automation Autofit Column (or Cell?) Width
    By orcinus in forum Programming
    Replies: 3
    Last Post: 02-09-2011, 11:44 AM
  4. Exporting to Excel with Automation using QueryDef
    By Niezels in forum Import/Export Data
    Replies: 3
    Last Post: 09-26-2010, 05:55 PM
  5. VBA to open excel, import on close of excel
    By bdaniel in forum Programming
    Replies: 0
    Last Post: 03-20-2010, 02:45 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums