Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,549
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Available Printer names to be placed in a range on a sheet and Force selection based on part of Printer name Corey Excel Programming 0 October 3rd 08 01:27 AM
store default printer, change printer and then restore default printer? Dennis Pedersen Excel Programming 0 November 14th 07 09:18 PM
members on my network printer not able to print to default printer smeheut Excel Discussion (Misc queries) 0 June 18th 07 06:42 PM
Prompt user to select a printer using a checkbox within a user Tom Ogilvy Excel Programming 0 January 10th 07 03:57 AM
How do I initiate the windows printer select object in Excel macro Mick B[_2_] Excel Programming 1 January 13th 05 09:46 PM


All times are GMT +1. The time now is 09:09 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"