Printer setup Popup

abenitez77

Board Regular
Joined
Dec 30, 2004
Messages
149
I run some code looping thru the tabs in a spreadsheet and I get a "printer setup" popup. It pops up every 10 minutes or so. How can I avoid this msg?

This is my code:

Code:
 Set connection2 = CreateObject("ADODB.Connection")
   ConnectionString = GetConnectionString
   connection2.Open ConnectionString
   
   'Disable messages from poping up, causing the code to pause.
   Application.AskToUpdateLinks = False
   Application.ScreenUpdating = False
   Application.DisplayAlerts = False
   Application.EnableEvents = False
   Application.ActivePrinter = "Microsoft XPS Document Writer on Ne01:"
   ActiveWindow.View = xlNormalView
    
   'Open the Spreadsheet
   On Error GoTo SkipRec_Error
   
    Set wbIn = Workbooks.Open(iPath, UpdateLinks:=0, ReadOnly:=True, CorruptLoad:=xlRepairFile)
    'Set New WorkBook Name
    NewWkBk = ActiveWorkbook.Name
    
    OpenXLFilePath = iPath
    ' ------------------------------ Remove Passwords from Each Tab ------------------------------------
    If ActiveSheet.ProtectContents = True Then
        If PasswordBreaker = False Then
            ' ----------- Password Failed, Copy the spreadsheet to a blank spreadsheet for processing ----------
            Call CopyProtectedDataToNewSheet
        End If
    End If
   ' ----------------------------------- Get Tab and Worksheet info ---------------------------------
    currentSheet = ActiveSheet.Index
    sheetcount = ActiveWorkbook.Sheets.Count
    
    ' Get the Path and File name of the spreadsheet
    xFilePath = iPath
    ' Get the File name (ONLY) of the spreadsheet
    xFileName = ActiveWorkbook.Name
    
    xFilePath = Replace(xFilePath, "'", "''")
    xFileName = Replace(xFileName, "'", "''")
    
    'Reset Flag
    ProcessedXLS = False
    HdrSkipRec = False  'If skip Header while import then SET TRUE else false
    DtlSkipRec = False  'If skip Detail while import then SET TRUE else false
    Reason = ""
    Result = False
   ' ----------------------------------- Loop thru each tab in the Spreadsheet -------------------------------
   For counter = 1 To sheetcount
        Sheets(counter).Activate
        xSheetName = Sheets(counter).Name
        Sheets(counter).Activate ' Set current Tab Active
        Sheets(counter).Visible = True
        Sheets(counter).Columns.EntireColumn.AutoFit ' *********** Added this line to expand width to fit dates/numbers/text/etc... ***********
        ActiveWindow.View = xlNormalView
        
        'Status Bar updates...
        Application.AskToUpdateLinks = False: Application.EnableEvents = False: Application.ScreenUpdating = False
        Application.DisplayAlerts = False: oldStatusBar = Application.DisplayStatusBar: Application.DisplayStatusBar = True
        Application.StatusBar = "Working on Record " & Str(xi) & " of " & Str(totx) & "  ( " & xSheetName & " )  Tab " & Str(counter) & " of " & Str(sheetcount)

        ' Checking All SheetNames.... Deals are found in names not with DEAL.
        HdrID = currid
        Set iRange = Nothing
        Set ResultRange = Nothing
        MySearch = "Vendor Information"
        Set iRange = Sheets(xSheetName).Range("A1:P2000")
        Set ResultRange = FindAll(iRange, MySearch)
        
        'Sheet name is not constant so check Is Deal Sheet or not?
        If Not (ResultRange Is Nothing) Then
            'Show all columns
            Columns("A:CZ").EntireColumn.Hidden = False
            'HdrSkipRec, DtlSkipRec and Reason are reference parameters.
           Call GetHeaderData(xSheetName, xFilePath, HdrID, ProcessedXLS, HdrSkipRec, DtlSkipRec, Reason)
        ElseIf IsItemDetailsSheet(xSheetName) = True Then
            'import Item details sheet
'            Call GetItemDetailsData(xSheetName, HdrID, DtlSkipRec, Reason, xFileName, xFilePath)
        Else
            If Not ProcessedXLS Then ProcessedXLS = False
        End If
NextTab:
    Next counter
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Are you sure you've specified the right printer and port combination?
 
Upvote 0
Are you sure you've specified the right printer and port combination?

I'm not printing anything. I think the default printer is pointing to (XPS Document writer) on my local laptop. I am running the code on a citrix desktop.
 
Upvote 0
You're setting the active printer (I don't know why if you aren't going to print anything).
 
Upvote 0
You're setting the active printer (I don't know why if you aren't going to print anything).

I was getting an error msg and this helped avoid it. I just rebooted the desktop and reran it and the popup msg is not coming up anymore. Setting the active printer removes this popup... I don't know why it stopped working but it is fixing the issue again for me. Issue solved. thanks
 
Upvote 0

Forum statistics

Threads
1,215,331
Messages
6,124,312
Members
449,152
Latest member
PressEscape

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top