Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Not able to initiate printer from checkbox
Hi all,
Hope someone is able to help. I have made some selections in a checkbox and each check correspond to a specific area that need to be printed. I can for some reason not get the print part to work, see code below. If StartSpecPrint = 1 Then Print_specific_companies.Show K = 1 Do While K < 3 jab = "ark" & K If jab < "" Then K = K + 1 Else knh = "Z" & K tt = "n" & K Sheets(jab).Select ActiveSheet.PageSetup.PrintArea = knh With ActiveSheet Dato = Format(Date, "dd mm yyyy") Tid = Format(Time, "hhmm") ' Defintion af datoformater. Filename = ValgtSti & "\" & ActiveSheet.Range(tt).Value & " " & Dato & " " & Tid & " " & ".pdf" ' Definition of where to save the file Application.ActivePrinter = "CutePDF Writer on CPW2:" .PrintOut Copies:=1, ActivePrinter:= _ "CutePDF Writer on CPW2:", Collate:=True newHour = Hour(Now()) newMinute = Minute(Now()) newSecond = Second(Now()) + 4 waitTime = TimeSerial(newHour, newMinute, newSecond) Application.Wait waitTime ' Excel waits 4 sec. for PDF to start SendKeys Filename & "{ENTER}", True ' Using Sendkeys command to write filename in dialogbox End With K = K + 1 End If Loop Exit Sub End If |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Not able to initiate printer from checkbox
The loop continues until K = 3 then the sub is exited. That is because jab is always < "". '-- Do While K < 3 jab = "ark" & K '<<<<< If jab < "" Then K = K + 1 Else PrintOut End If Loop Exit Sub '-- Jim Cone Portland, Oregon USA http://tinyurl.com/ExtrasForXL .. .. .. "JanB" wrote in message Hi all, Hope someone is able to help. I have made some selections in a checkbox and each check correspond to a specific area that need to be printed. I can for some reason not get the print part to work, see code below. If StartSpecPrint = 1 Then Print_specific_companies.Show K = 1 Do While K < 3 jab = "ark" & K If jab < "" Then K = K + 1 Else knh = "Z" & K tt = "n" & K Sheets(jab).Select ActiveSheet.PageSetup.PrintArea = knh With ActiveSheet Dato = Format(Date, "dd mm yyyy") Tid = Format(Time, "hhmm") ' Defintion af datoformater. Filename = ValgtSti & "\" & ActiveSheet.Range(tt).Value & " " & Dato & " " & Tid & " " & ".pdf" ' Definition of where to save the file Application.ActivePrinter = "CutePDF Writer on CPW2:" .PrintOut Copies:=1, ActivePrinter:= _ "CutePDF Writer on CPW2:", Collate:=True newHour = Hour(Now()) newMinute = Minute(Now()) newSecond = Second(Now()) + 4 waitTime = TimeSerial(newHour, newMinute, newSecond) Application.Wait waitTime ' Excel waits 4 sec. for PDF to start SendKeys Filename & "{ENTER}", True ' Using Sendkeys command to write filename in dialogbox End With K = K + 1 End If Loop Exit Sub End If |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Available Printer names to be placed in a range on a sheet and Force selection based on part of Printer name | Excel Programming | |||
store default printer, change printer and then restore default printer? | Excel Programming | |||
members on my network printer not able to print to default printer | Excel Discussion (Misc queries) | |||
Prompt user to select a printer using a checkbox within a user | Excel Programming | |||
How do I initiate the windows printer select object in Excel macro | Excel Programming |