Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Print Preview of Excel worksheet in VB codes

Posted on 2002-03-07
3
Medium Priority
?
535 Views
Last Modified: 2012-06-27
I was coding in VB, required to show a PRINT PREVIEW of an EXCEL worksheet , WITHOUT USERS ABLE TO CHANGE THE CONTENTS OF THE PREVIEW WORKSHEET, JUST LIKE MS OFFICE PRINT PREVIEW. How should I go about doing it? Without USING EXCEL OBJECTS. Thanks!
0
Comment
Question by:sunburnt
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
3 Comments
 
LVL 53

Accepted Solution

by:
Ryan Chong earned 600 total points
ID: 6849502
Hi sunburnt,

This should solve your problem:

Private Sub Command1_Click()
    Dim iExcel As Excel.Application
    Dim iWBook As Workbook
    Dim iWSheet As Worksheet
    TempDBPath = "D:\Project\Icon\develop\DO.xls"
    Set iExcel = CreateObject("excel.application")
    iExcel.Visible = True
    Set iWBook = iExcel.Application.Workbooks.Open(TempDBPath)
    Set iWSheet = iWBook.Worksheets("gr")
    iWSheet.PrintPreview False
    'Set iWSheet = Nothing
    'iWBook.Close True
    'Set iWBook = Nothing
    'iExcel.Quit
    'Set iExcel = Nothing
End Sub

Cheers,
ryancys
0
 
LVL 53

Expert Comment

by:Ryan Chong
ID: 6849516
Ohya, make sure to add the M$ Excel 9.0 Object Library from References.
0
 
LVL 53

Expert Comment

by:Ryan Chong
ID: 6849537
> Without USING EXCEL OBJECTS
Sorry, Excel Object is required here..
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question