Results 1 to 5 of 5

Thread: Hiding Dialog Box in Excel from VB

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 1999
    Location
    Hamilton, New Zealand
    Posts
    137
    I'm having trouble hiding the dialog box that excel displays when printing something.

    I can disable every other dialog by setting the displayalerts property to false, but this only affects dialogs that require input from the user.

    The dialog i am talking about is the one that says
    Now Printing Page # of #
    on the Printer Name
    And has a cancel button

    I am accessing Excel from my VB program and it is not visible but this little box flashes up all the time when I print.

    Does anyone have any ideas on how to hide it?

    Regards

    Matt Brown
    Hamilton, NZ
    VB6 C++ in Visual Studio 6sp4
    VB.net Beta 1

  2. #2
    Addicted Member
    Join Date
    Oct 2000
    Location
    Vienna/Austria
    Posts
    132
    Hi mattbrown !!!

    As far as I know you can't hide the window. After a researching in "deja" I found out that the only possible solution is that uou can find the window handle and destroy them. But initial the window appears.

    Sorry for no better solution.

    -cu TheOnly

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Aug 1999
    Location
    Hamilton, New Zealand
    Posts
    137
    Thats what i had feared

    what a bloody pain the customer is complaining about it flashing up all the time

    got any ideas on possible workarounds?
    Regards

    Matt Brown
    Hamilton, NZ
    VB6 C++ in Visual Studio 6sp4
    VB.net Beta 1

  4. #4
    Hyperactive Member tomjess's Avatar
    Join Date
    Mar 2001
    Location
    Hamilton, New Zealand
    Posts
    348

    I get the following message

    I am using this code, below and it works a treat. My only problem
    is that after every thing has finished printing I get the Excel message box asking do I want to save the Excel file, Yes/No.

    Have you any idea how to stop Excel asking thais question?,I do not want the user to have to do this everytime they print.

    Private Sub cmdClick_Click()

    On Error Resume Next
    Set objExcel = GetObject(",Excel.Application")
    If Err.Number <> 0 Then
    Set objExcel = CreateObject("Excel.Application")
    End If
    Err.Clear
    On Error GoTo 0

    objExcel.Visible = False
    'objExcel.Workbooks.Open filename:="C:\Psp\define.xls"
    'objExcel.Visible = True
    'objExcel.WindowState = xlNormal
    objExcel.Workbooks.Open filename:="C:\Psp\define.xls"
    objExcel.Cells(22, 8).Value = txtStan(54).Text
    objExcel.Cells(1, 1).Value = txtStan(50).Text
    objExcel.Cells(2, 1).Value = txtStan(52).Text
    objExcel.Cells(3, 1).Value = txtStan(51).Text
    objExcel.Cells(4, 1).Value = txtStan(53).Text
    objExcel.Cells(5, 1).Value = txtStan(55).Text
    objExcel.Cells(6, 1).Value = txtStan(56).Text
    objExcel.Cells(7, 1).Value = txtStan(57).Text
    objExcel.Cells(8, 1).Value = txtStan(58).Text

    objExcel.ActiveWorkbook.PrintOut
    objExcel.Quit

    End Sub

    Thanks
    kia kaha kia maia - give of your best, be confident in your own ability

  5. #5
    Fanatic Member
    Join Date
    May 2001
    Posts
    837
    try closing each book individualy and telling it whether or not to save changes

    VB Code:
    1. Dim book As Excel.Workbook
    2.  
    3. For Each book In objExcel.Workbooks
    4.     book.Close False 'or true if you want to save changes
    5. Next book
    The human brain cannot hold all of the knowledge that exists in this world, but it can hold pointers to that knowledge.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width