Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default print from listbox

I am so excited! I have automated charts in excel, so that the user ca
open to a menu worksheet, refresh all of the chart's data (wit
parameter) and preview and print them.

I am learning vb as I go, and I don't think I am do TOO bad. Anyway,
wanted to make a user form in the vb code to have a list box. I woul
make a 4th button on this menu sheet, so that the user can choose t
print just 1 or more chart, rather than all of them.

I created the list box, and populated it list. This is a multiselec
with checkboxes.

Private Sub UserForm_Initialize()
'The 1st list box contains 3 data columns
ListBox1.ColumnCount = 7

'Load integer values into first column of MyArray


'Load columns 2 and three of MyArray
MyArray(0, 0) = "Domestic Long Distance"
MyArray(1, 0) = "Toll Free"
MyArray(2, 0) = "Directory Assistance"
MyArray(3, 0) = "Local"
MyArray(4, 0) = "International"
MyArray(5, 0) = "Calling Cards"
MyArray(6, 0) = "Usage Type"


'Load data into ListBox1
ListBox1.List() = MyArray

End Sub


Now I will have a command button on the user form to print the selecte
charts. My question is, how do I do that?

I have looked for the code, but I am not finding a direct answer.
figure I need to declare each row value = to the chart that I have, an
then for each value selected print that chart. Right?

Any help on this code would be great!
Thanks all.

This is fun. I want to be a vb expert! hehehehe
misscrf

Management is doing things right, leadership is doing the right thing

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default print from listbox

PrivateSub Commandbutton1_Click()
With listbox1
for i = 0 to .listcount - 1
if .selected(i) then
for each chtObj in Activesheet.ChartObjects
if lcase(chtObj.Chart.Name) = lcase(.list(i)) then
chtObject.Chart.Printout
Exit for
end if
Next
end if
Next
End with
End Sub

Assumes the chart name is the same as the entries in the listbox.
Untested, but this should be close.
--
Regards,
Tom Ogilvy


"misscrf " wrote in message
...
I am so excited! I have automated charts in excel, so that the user can
open to a menu worksheet, refresh all of the chart's data (with
parameter) and preview and print them.

I am learning vb as I go, and I don't think I am do TOO bad. Anyway, I
wanted to make a user form in the vb code to have a list box. I would
make a 4th button on this menu sheet, so that the user can choose to
print just 1 or more chart, rather than all of them.

I created the list box, and populated it list. This is a multiselect
with checkboxes.

Private Sub UserForm_Initialize()
'The 1st list box contains 3 data columns
ListBox1.ColumnCount = 7

'Load integer values into first column of MyArray


'Load columns 2 and three of MyArray
MyArray(0, 0) = "Domestic Long Distance"
MyArray(1, 0) = "Toll Free"
MyArray(2, 0) = "Directory Assistance"
MyArray(3, 0) = "Local"
MyArray(4, 0) = "International"
MyArray(5, 0) = "Calling Cards"
MyArray(6, 0) = "Usage Type"


'Load data into ListBox1
ListBox1.List() = MyArray

End Sub


Now I will have a command button on the user form to print the selected
charts. My question is, how do I do that?

I have looked for the code, but I am not finding a direct answer. I
figure I need to declare each row value = to the chart that I have, and
then for each value selected print that chart. Right?

Any help on this code would be great!
Thanks all.

This is fun. I want to be a vb expert! hehehehe
misscrf

Management is doing things right, leadership is doing the right things


---
Message posted from http://www.ExcelForum.com/



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
listbox B conditional of input in Listbox A Kim K Excel Discussion (Misc queries) 1 October 31st 06 08:27 PM
Multicolumn Listbox and ordinary listbox Ron_D Excel Programming 0 June 4th 04 08:56 PM
listbox.value not equal to listbox.list(listbox.listindex,0) ARB Excel Programming 0 October 22nd 03 12:46 AM
Is refreshing listbox rowsource in listbox click event possible? Jeremy Gollehon[_2_] Excel Programming 4 September 25th 03 06:45 PM
print listbox contents Dave Peterson[_3_] Excel Programming 1 August 26th 03 04:13 AM


All times are GMT +1. The time now is 11:13 AM.

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

About Us

"It's about Microsoft Excel"