-
Mar 22nd, 2010, 02:18 AM
#1
Thread Starter
New Member
[Excel] print preview problem
Hi Guys...
I am new to this thread as i am new to vb programming.
now, the problem is that in my application i m generating sql database. the data is displayed in datagridview. the user has a facility to filter data according to certain parameters. once filtered, user should be able print or perview the data. for the printing purpose i m writing the filtered data to excel sheet which is displayed in another tab. from here he can give print or printpreview command.
catch : when the user clicks print command, every thing works fine. i.e. print dialog comes up and on ok sheet gets printed. but when user issues print preview command, nothing nothing happens. preview window doesnt shows up.
what could be the problem or is there any other way to do this?
any help or suggestions will be highly appreciated.
-
Mar 22nd, 2010, 10:45 AM
#2
Addicted Member
Re: [Excel] print preview problem
Please supply the version of VBA/Office and the code you are using on your Preview button
-
Mar 22nd, 2010, 11:13 PM
#3
Thread Starter
New Member
Re: [Excel] print preview problem
thnks for ur reply Smartacus
version : vb express 2008, office : 2003
Private Sub PrintPreviewToolStripMenuItem_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PrintPreviewToolStripMenuItem.Click
'Me.TabControl1.SelectTab(1)
If Not Populated Then Populate_Data()
PPrv = True
If Not Loaded Then
LoadBrowser()
Else
PPrv = False
WB2.ShowPrintPreviewDialog()
End If
End Sub
it first checks whether excel sheet is generated and data is written in it. if not does it and then loads that xl sheet in webbrowser and preview dialog is called in another routine but is exactly as is here. if already populated and loaded by some other routine then show print preview dialog.
note: print dialog is also used in exactly same way. it works perfect but preview doesnt. cant figure out whats the difference between them as both are webbrowser commands.
please suggest some solution.
thnks again.
-
Mar 23rd, 2010, 03:36 AM
#4
Re: [Excel] print preview problem
and we all thought the preview button was in excel!!!!!!!
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Mar 23rd, 2010, 10:58 PM
#5
Thread Starter
New Member
Re: [Excel] print preview problem
any solutions, suggestions please ?
-
Mar 24th, 2010, 12:00 AM
#6
Lively Member
Re: [Excel] print preview problem
I don't know if this will help, but if you can do the following within the application (and there is something to print) it should work.
Code:
ActiveWindow.SelectedSheets.PrintPreview
this is the VBA code and I have absolutely no experience when it comes to linking .net (orVB6) to an application, but hopefully this helps
Last edited by tarius222000; Mar 24th, 2010 at 12:00 AM.
Reason: sp
-
Mar 24th, 2010, 01:39 AM
#7
Re: [Excel] print preview problem
can you do it manually in your webbrowser?
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Mar 24th, 2010, 04:41 AM
#8
Thread Starter
New Member
Re: [Excel] print preview problem
Originally Posted by tarius222000
I don't know if this will help, but if you can do the following within the application (and there is something to print) it should work.
Code:
ActiveWindow.SelectedSheets.PrintPreview
this is the VBA code and I have absolutely no experience when it comes to linking .net (orVB6) to an application, but hopefully this helps
i have tried it with no luck.
isn't there any other way pleaseeeeeeeeeeeeeeeee.
-
Mar 24th, 2010, 05:07 AM
#9
Re: [Excel] print preview problem
this really .net programming, maybe better to get answer in vb.net forum
pm a mod to move if appropriate
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Mar 24th, 2010, 06:01 AM
#10
Thread Starter
New Member
Re: [Excel] print preview problem
Originally Posted by westconn1
this really .net programming, maybe better to get answer in vb.net forum
pm a mod to move if appropriate
ok. thanks to all for ur replies. i m moving to vb.net forums.
chenz
-
Mar 24th, 2010, 11:36 AM
#11
Addicted Member
Re: [Excel] print preview problem
Chenz, If you are starting a new post in VB.Net, be sure to specify the version VB Express and Office version.
Post your code that is firing the print preview to get the fastest response. If there is no info, many will move on to help those who are more detailed. Details, Details, Details!
-
Mar 27th, 2010, 08:12 AM
#12
Thread Starter
New Member
Re: [Excel] print preview problem
hi guys ...
i m back here because i didnt get any response on vb dot net forums. not a single reply.
i think we guys will have to solve it over here itself
ok, now. what should i do next.
please guide me. i m totally lost.
chenz
-
Mar 29th, 2010, 02:57 AM
#13
Re: [Excel] print preview problem
Chenz, Can you answer Pete's question in Post # 7
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread "Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|