Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 80
Default printing list box in the user form

Hi Everyone,
Is there anyway only print listbox in the user form or save the list
box values as a text file? I have a listbox in a user form which
sometimes has listbox1.listcount is more than 40. When you see the
listbox its ok you can scroll down to see other values after
listcount
40 but cannot see all the values in the listbox when you printing.
Is there anyway to do that?
Your help is greatly appreciated

best regards,
Baha

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default printing list box in the user form

This worked ok for me:

Option Explicit
Private Sub CommandButton1_Click()

Dim TempWks As Worksheet
Set TempWks = Workbooks.Add(1).Worksheets(1)
With Me.ListBox1
TempWks.Range("a1").Resize(.ListCount - 1, .ColumnCount).Value _
= .List
End With

Me.Hide
With TempWks
.UsedRange.Columns.AutoFit
.PrintOut preview:=True
'close and don't save
.Parent.Close savechanges:=False
End With
Me.Show

End Sub
Private Sub UserForm_Initialize()
Dim iCtr As Long
With Me.ListBox1
.ColumnCount = 3
For iCtr = 1 To 5
.AddItem "A" & iCtr
.List(.ListCount - 1, 1) = "B" & iCtr
.List(.ListCount - 1, 2) = "C" & iCtr
Next iCtr
End With
End Sub




" wrote:

Hi Everyone,
Is there anyway only print listbox in the user form or save the list
box values as a text file? I have a listbox in a user form which
sometimes has listbox1.listcount is more than 40. When you see the
listbox its ok you can scroll down to see other values after
listcount
40 but cannot see all the values in the listbox when you printing.
Is there anyway to do that?
Your help is greatly appreciated

best regards,
Baha


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 80
Default printing list box in the user form

Hi Dave,
you are great thanks it all works fine for me.
Thanks again
regards,
baha

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 80
Default printing list box in the user form

Hi Dave,
One more thing why on the printout I have #N/A on the right side of
the page?
it looks like displays error for every row in the list box
thanks again

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default printing list box in the user form

I don't know.

Did you modify the code (change the columncount info)?

If you did modify the code, post your current version.

How do you populate the listbox and how many columns are there?

And one more--Any columns hidden in the listbox???

" wrote:

Hi Dave,
One more thing why on the printout I have #N/A on the right side of
the page?
it looks like displays error for every row in the list box
thanks again


--

Dave Peterson
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
Printing the contents of a text control on a user form Chaplain Doug Excel Programming 3 May 24th 06 08:32 PM
Command Button on User form for Printing Anthony Slater Excel Discussion (Misc queries) 2 September 7th 05 02:01 PM
Printing Part of User Form mully New Users to Excel 1 May 26th 05 08:22 AM
Printing a User Form mully New Users to Excel 6 May 19th 05 01:26 PM
Printing a user form landscape Dave[_32_] Excel Programming 1 December 21st 03 03:51 PM


All times are GMT +1. The time now is 12:17 AM.

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"