Hi Everyone,
I copied the following code from an example I found online. I modified it so that it would work in my workbook. I have the listbox in a userform, rather than in a sheet as in the example I took this from. I have a button on my primary (first) sheet which then calls a userform that contains the list box. Everything is working perfectly except the print preview. When I walk through the code I get a "Run-time error '13': type mismatch" error at the line indicated in my code, below. I'm not real familiar with VBA, so I'm finding examples on line and attempting to modify them in my sheet to get the outcome I desire. I have a basic understanding of this type of error after googling it, but don't know how to fix it. Any help is appreciated. I changed the With statement in the code which originally had "ActiveSheet.ListBoxSh" rather than "PrintBox.ListBoxSh". My userform is called PrintBox, so it seemed appropriate to make this change. I don't know if this is part of my problem or not.
Also, I can select the sheets I want once the userform pops up, but I then want to link the print/print preview to another button on the userform. I think this will require me to rewrite the "Sheets(SheetArray()).PrintPreview/PrintOut so that they are activated when I click the button(s) on the userform. How would I accomplish this?
Bookmarks