+ Reply to Thread
Results 1 to 6 of 6

ActivePrinter in Excel changes!

  1. #1
    GarySmith2
    Guest

    ActivePrinter in Excel changes!

    During a long running excel macro that also sets page margins and headers, I
    set the activeprinter at the start of the macro but it changes dynamically if
    the system default printer changes during the macro's execution. This causes
    the macro to fail. Is there some property that can be set to not allow the
    activeprinter to be changed? The biggest problem occurs on terminal services
    when a user logs off and are left without any default printer assignment
    which causes excel to prompt for one. My macro runs unattended so it just
    hangs waiting for user input.

    Please help!

  2. #2
    Jim Thomlinson
    Guest

    RE: ActivePrinter in Excel changes!

    Why not set the active printer in the Before_Print event in ThisWorkbook
    instead of a t the beginning of execution?
    --
    HTH...

    Jim Thomlinson


    "GarySmith2" wrote:

    > During a long running excel macro that also sets page margins and headers, I
    > set the activeprinter at the start of the macro but it changes dynamically if
    > the system default printer changes during the macro's execution. This causes
    > the macro to fail. Is there some property that can be set to not allow the
    > activeprinter to be changed? The biggest problem occurs on terminal services
    > when a user logs off and are left without any default printer assignment
    > which causes excel to prompt for one. My macro runs unattended so it just
    > hangs waiting for user input.
    >
    > Please help!


  3. #3
    GarySmith2
    Guest

    RE: ActivePrinter in Excel changes!

    The macro doesn't print - it just prepares it for printing so users can print
    on their printer. The question are: why does the activeprinter change? And
    How can I prevent it from changing?

    Thanks,
    Gary..

    "Jim Thomlinson" wrote:

    > Why not set the active printer in the Before_Print event in ThisWorkbook
    > instead of a t the beginning of execution?
    > --
    > HTH...
    >
    > Jim Thomlinson
    >
    >
    > "GarySmith2" wrote:
    >
    > > During a long running excel macro that also sets page margins and headers, I
    > > set the activeprinter at the start of the macro but it changes dynamically if
    > > the system default printer changes during the macro's execution. This causes
    > > the macro to fail. Is there some property that can be set to not allow the
    > > activeprinter to be changed? The biggest problem occurs on terminal services
    > > when a user logs off and are left without any default printer assignment
    > > which causes excel to prompt for one. My macro runs unattended so it just
    > > hangs waiting for user input.
    > >
    > > Please help!


  4. #4
    Jim Thomlinson
    Guest

    RE: ActivePrinter in Excel changes!

    I assume you are using

    Application.Activeprinter = "??"

    This does not change anything in the actual workbook itself. It only changes
    the instance of Excel (application) that you are currently working in... I am
    not sure exactly what you are doing with this book... Do you run it and then
    save it and distribute it to end users. If so then the active printer
    associated with their application will be the one that is used...
    --
    HTH...

    Jim Thomlinson


    "GarySmith2" wrote:

    > The macro doesn't print - it just prepares it for printing so users can print
    > on their printer. The question are: why does the activeprinter change? And
    > How can I prevent it from changing?
    >
    > Thanks,
    > Gary..
    >
    > "Jim Thomlinson" wrote:
    >
    > > Why not set the active printer in the Before_Print event in ThisWorkbook
    > > instead of a t the beginning of execution?
    > > --
    > > HTH...
    > >
    > > Jim Thomlinson
    > >
    > >
    > > "GarySmith2" wrote:
    > >
    > > > During a long running excel macro that also sets page margins and headers, I
    > > > set the activeprinter at the start of the macro but it changes dynamically if
    > > > the system default printer changes during the macro's execution. This causes
    > > > the macro to fail. Is there some property that can be set to not allow the
    > > > activeprinter to be changed? The biggest problem occurs on terminal services
    > > > when a user logs off and are left without any default printer assignment
    > > > which causes excel to prompt for one. My macro runs unattended so it just
    > > > hangs waiting for user input.
    > > >
    > > > Please help!


  5. #5
    GarySmith2
    Guest

    RE: ActivePrinter in Excel changes!

    Yes I set it that way. My VB application runs in batch overnight to prepare
    reports for end users. In order for my excel macro to format the xls file for
    end user printing (setting margins, headers and landscape) it needs to have
    an active printer set. Not an actual printer, it just needs a print driver
    installed which the system has setup. This all works fine except that excel
    will change the active printer to a terminal server user's printer. When this
    user then logs off, the system is left without a default printer and excel
    now has an invalid ActivePrinter, not the one I set.

    This application is on Windows Server 2003 and Office 2003.

    Thanks again,
    Gary Smith

    "Jim Thomlinson" wrote:

    > I assume you are using
    >
    > Application.Activeprinter = "??"
    >
    > This does not change anything in the actual workbook itself. It only changes
    > the instance of Excel (application) that you are currently working in... I am
    > not sure exactly what you are doing with this book... Do you run it and then
    > save it and distribute it to end users. If so then the active printer
    > associated with their application will be the one that is used...
    > --
    > HTH...
    >
    > Jim Thomlinson
    >
    >
    > "GarySmith2" wrote:
    >
    > > The macro doesn't print - it just prepares it for printing so users can print
    > > on their printer. The question are: why does the activeprinter change? And
    > > How can I prevent it from changing?
    > >
    > > Thanks,
    > > Gary..
    > >
    > > "Jim Thomlinson" wrote:
    > >
    > > > Why not set the active printer in the Before_Print event in ThisWorkbook
    > > > instead of a t the beginning of execution?
    > > > --
    > > > HTH...
    > > >
    > > > Jim Thomlinson
    > > >
    > > >
    > > > "GarySmith2" wrote:
    > > >
    > > > > During a long running excel macro that also sets page margins and headers, I
    > > > > set the activeprinter at the start of the macro but it changes dynamically if
    > > > > the system default printer changes during the macro's execution. This causes
    > > > > the macro to fail. Is there some property that can be set to not allow the
    > > > > activeprinter to be changed? The biggest problem occurs on terminal services
    > > > > when a user logs off and are left without any default printer assignment
    > > > > which causes excel to prompt for one. My macro runs unattended so it just
    > > > > hangs waiting for user input.
    > > > >
    > > > > Please help!


  6. #6
    Jim Thomlinson
    Guest

    RE: ActivePrinter in Excel changes!

    There is not much I can help you here. I don't think Excel really is the
    problem here. It sounds more like an issue with the application being server
    based and how the printers are being handled by the server. Or possibly it
    has to do with restrictions placed on the application to allow/disallow users
    from modifying (persistently) setting such as printers.
    --
    HTH...

    Jim Thomlinson


    "GarySmith2" wrote:

    > Yes I set it that way. My VB application runs in batch overnight to prepare
    > reports for end users. In order for my excel macro to format the xls file for
    > end user printing (setting margins, headers and landscape) it needs to have
    > an active printer set. Not an actual printer, it just needs a print driver
    > installed which the system has setup. This all works fine except that excel
    > will change the active printer to a terminal server user's printer. When this
    > user then logs off, the system is left without a default printer and excel
    > now has an invalid ActivePrinter, not the one I set.
    >
    > This application is on Windows Server 2003 and Office 2003.
    >
    > Thanks again,
    > Gary Smith
    >
    > "Jim Thomlinson" wrote:
    >
    > > I assume you are using
    > >
    > > Application.Activeprinter = "??"
    > >
    > > This does not change anything in the actual workbook itself. It only changes
    > > the instance of Excel (application) that you are currently working in... I am
    > > not sure exactly what you are doing with this book... Do you run it and then
    > > save it and distribute it to end users. If so then the active printer
    > > associated with their application will be the one that is used...
    > > --
    > > HTH...
    > >
    > > Jim Thomlinson
    > >
    > >
    > > "GarySmith2" wrote:
    > >
    > > > The macro doesn't print - it just prepares it for printing so users can print
    > > > on their printer. The question are: why does the activeprinter change? And
    > > > How can I prevent it from changing?
    > > >
    > > > Thanks,
    > > > Gary..
    > > >
    > > > "Jim Thomlinson" wrote:
    > > >
    > > > > Why not set the active printer in the Before_Print event in ThisWorkbook
    > > > > instead of a t the beginning of execution?
    > > > > --
    > > > > HTH...
    > > > >
    > > > > Jim Thomlinson
    > > > >
    > > > >
    > > > > "GarySmith2" wrote:
    > > > >
    > > > > > During a long running excel macro that also sets page margins and headers, I
    > > > > > set the activeprinter at the start of the macro but it changes dynamically if
    > > > > > the system default printer changes during the macro's execution. This causes
    > > > > > the macro to fail. Is there some property that can be set to not allow the
    > > > > > activeprinter to be changed? The biggest problem occurs on terminal services
    > > > > > when a user logs off and are left without any default printer assignment
    > > > > > which causes excel to prompt for one. My macro runs unattended so it just
    > > > > > hangs waiting for user input.
    > > > > >
    > > > > > Please help!


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1