473,411 Members | 1,997 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,411 software developers and data experts.

Print Preview Excel Template with VB 2010

14
*sigh*

I can't get this to work. My program fills all the values into an Excel spreadsheet- no problems there. What I'd like to do is a print preview/print function. I can't seem to get my code right, all I get are blank pages in the print preview box.

Expand|Select|Wrap|Line Numbers
  1.             Dim oExcel As Object = CreateObject("Excel.Application")
  2.             oExcel.Workbooks.Open("C:\DailyLogs\DailyLog.xlsx")
  3.             PrintPreviewDialog1.Document = PrintDocument1
  4.             PrintPreviewDialog1.ShowDialog()
  5.             oExcel.Sheet1.PrintPreview()
So as I see it, this should open excel, then navigate to the actual excel file. The print preview dialog should come up, which it does, and the excel sheet 1 should be previewing, but it's not? I don't have any errors, just a blank print preview.

Does anyone have any ideas? I've been up and down the internet with no luck.

Thanks
Oct 1 '10 #1
1 4399
danp129
323 Expert 256MB
If you exit the code, leaving the sheet open, does print preview look right?

If you do a print preview while recording a macro, do you see anything done in code it generates that is helpful?
Oct 1 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: HuggedRugger | last post by:
Hi, Can anyone help me with this. I have a datagrid on a web page I want to send to an excel sheet to print as a report. I send the data using command from my aspx.vb file which works...
1
by: Eager-Learner | last post by:
Through window.open or window.showmodaldialog, I want to open a word or excel document in Print Preview mode. Bcos I don't want the user to make any changes or save it but the user can ONLY VIEW OR...
7
by: Pat | last post by:
I would like to send the Print Preview of a MS Access form to a Snapshot file. The form contains an OLE graph. BACKGROUND A snapshot of a report is possible. If I could I would use a report to...
2
by: Dean Slindee | last post by:
Anybody written code in VB.NET to: 1) show a print preview window of reports already written and stored in an Access 2002 database; or 2) execute the print of a report stored in an Access 2002...
2
by: Mr. California | last post by:
As a novice VBA programmer, I have a problem with a routine written as a click procedure from a form to open an Excel template, insert some information, print, and (ideally) return control back to...
0
by: sqldude | last post by:
How can I disable the print preview while printing an excel file from C# code? Thanks.
2
by: Lark | last post by:
Hello and help. Im a novice to access but pretty good with word and excel, My access form will not show up in the preview mode? I checked params like box sizes and page layout but there is no...
1
by: jack | last post by:
Hi all Was working on Office web component 3.0 which fits in to my projects. but came across one problem in excel when we give the print preview it displays the whole format of the sheet. even...
6
by: beulajo | last post by:
I have a webpage which has grid entry with paging, and all the other asp controls, I need to print this page for the user with the print preview option. What I have done right now is I have...
1
didajosh
by: didajosh | last post by:
Hi, I am working on a accounting report.it looks like ------------------------------------------------------------------------------------------- Group code (group by) Org Code(group by) ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.