GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Programming  >  VBA
Next Question 
 VBA  |  Question 1 of 60    Print  
How to set the custome paper size in Excel Object through VB?

  
Total Answers and Comments: 1 Last Update: July 20, 2006   
  
 Sponsored Links

 
 Best Rated Answer
Submitted by: Pallavi Baviskar
 

    dim xlapp As Excel.Application
    dim xlbook As Excel.Workbook
    dim xlsheet As Excel.Worksheet
    dim xlPgSetup As Excel.PageSetup

    Set xlapp = New Excel.Application
    Set xlbook = xlapp.Workbooks.Open(App.Path & "try.xls") 'Open any  file here

    xlbook.Activate 
    DoEvents

    Set xlsheet = xlbook.Worksheets(1)    'Set any worksheet
    xlsheet.Activate

    Set xlPgSetup = xlsheet.PageSetup ' assign pagesetup of current sheet to xlPgSetup object
    xlPgSetup.PaperSize = xlPaperLetter 'Set the papersize here

    'xlPgSetup.PaperSize = xlPaperA4
    xlPgSetup.Orientation = xlLandscape

I am sure that there must be few more methods of doing the same job. Just u need to find all.

Pallavi Baviskar.



Above answer was rated as good by the following members:
frankjiang
July 20, 2006 07:59:53   #1  
Pallavi Baviskar        

RE: How to set the custome paper size in Excel Object ...

dim xlapp As Excel.Application
dim xlbook As Excel.Workbook
dim xlsheet As Excel.Worksheet
dim xlPgSetup As Excel.PageSetup

Set xlapp New Excel.Application
Set xlbook xlapp.Workbooks.Open(App.Path & try.xls ) 'Open any file here

xlbook.Activate
DoEvents

Set xlsheet xlbook.Worksheets(1) 'Set any worksheet
xlsheet.Activate

Set xlPgSetup xlsheet.PageSetup ' assign pagesetup of current sheet to xlPgSetup object
xlPgSetup.PaperSize xlPaperLetter 'Set the papersize here

'xlPgSetup.PaperSize xlPaperA4
xlPgSetup.Orientation xlLandscape

I am sure that there must be few more methods of doing the same job. Just u need to find all.

Pallavi Baviskar.


 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    

 Related Questions

Latest Answer :     dim xlapp As Excel.Application    dim xlbook As Excel.Workbook    dim xlsheet As Excel.Worksheet    dim xlPgSetup As Excel.PageSetup    Set xlapp = New ...

Difference between a function and a subroutine, Dynaset and napshot, early and late binding, image and picture controls, Linked Object and Embedded Object, list box and combo box, List index and Tab index, modal and modules window, Object and Class, Query unload and unload in form, declaration and Instantiation an object?
Read Answers (1) | Asked by : Beena

Latest Answer : The Parameters collection ...
Read Answers (1) | Asked by : Beena

Latest Answer : Yes VB 6.0 Supports OOPS, Because VB6.0 is an Object Based Progarmming Language, and it also known as 'Event Driven Programming'it supports Polymorphism - Yes Encapsulation - Yes Inheritance - Partially support (Not full) Thanks & Regards ...
Read Answers (2) | Asked by : Beena

What methods are called from the ObjectContext object to inform MTS that the transaction was successful or unsuccessful?
Read Answers (1) | Asked by : Beena

Which property of textbox cannot be changed atruntime and what’s the maximum size of a textbox?
Read Answers (3) | Asked by : Beena

1) You are creating a client application that calls ActiveX DLLs. Which of the following properties of the Err object provides the name of a component that sends an error back to the client application? a. Number b. Description c. CompName d. Component e. Source f. Text g. Desc h. None of the above2) If the Cancel Error Property of the CommonDialog Box is set to true then which of the following statement is true: a. A runtime error can result if the user clicks the cancel button b. A
please give me the answer for this . who is the master. 
Read Answers (1) | Asked by : shailesh

How can I call up oracle discoverer from Microsoft Excel, find a particular piece of data and transfer it into Excel -e.g. can I use a macro in Excel to call up discoverer
View Question | Asked by : Roydn Jones

Latest Answer : COM means Component Object Model it is a windows default object which has got lib files in the sys dir. As for VB we need to add in .dll files to update COM files. ...


 Sponsored Links

 
Related Articles

ODP.NET - OracleCommand Object

ODP NET More About the OracleCommand Object Till now we have seen OracleCommand working with OracleDataReader OracleCommand is not simply meant for OracleDataReader It has got a lot of functionality for itself Let us see few of the most commonly used features of OracleCommand in this section We will
 

Microsoft AJAX Library - Creating Object Members on the Fly

Creating Object Members on the Fly One major difference between OOP in C and ASP NET and OOP in JavaScript is that JavaScript allows creating object members on the fly" This is true for objects and classes that you create yourself and also for JavaScript s own objects and types as well He
 

Microsoft AJAX Library - Object-Oriented JavaScript

Object Oriented JavaScript Objects and classes are implemented differently in JavaScript than in languages such as C VB NET Java or C However when it comes to using them you ll feel on familiar ground You create objects using the new operator and you call their methods or access their fields using t
 

Concepts of Object-Oriented Programming

Object Oriented JavaScript In this chapter you ll learn about OOP Object Oriented Programming and how it relates to JavaScript As an ASP NET developer you probably have some experience working with objects and you may even be familiar with concepts such as inheritance However unless you re already a
 

Using XML with Microsoft Excel

Using XML with Microsoft Excel One of the most useful features for a programmer would be Microsoft Excel s capability to support XML schemas which are user defined Though it is not a very prominent feature which can be obviously noted it still exists and is very functional tool In simple English it
 

Object-Oriented Client-Server Internet

Object Oriented Client Server Internet OCSI Environments as IT Infrastructure Client Server Basics Object Oriented Client Server Internet OCSI environments provide the IT infrastructure for supporting OCSI applications For our purposes infrastructure refers to operating systems networks middleware
 

JavaScript String Object

JavaScript String Object In this JavaScript tutorial you will learn about String Object purpose of string object in JavaScript purpose of string object indexof method lastIndexOf method and substring method along with syntax and example mosgoogle center Purpose of String Object in JavaScript The mai
 

JavaScript Date Object

JavaScript Date Object In this JavaScript tutorial you will learn about date object and methods of date object explained along with syntax and example mosgoogle center JavaScript Date Object Usage of Date Object Date object of Java Script is used to work with date and times General syntax for defini
 

SQL Programming

SQL Programming Overview Anybody who has done something for a long time has probably wanted to change how things work at some point or another. A worker at a mill might have found a more efficient way of cutting logs, or a mathematics teacher might have had a hand in changing a school’s al
 

The Interview Snafu

How to turn someone else’s mistake to your advantage Your dream job is about to become reality. A recruiter gave you the heads up about the perfect position at Humungous Conglomerate, Inc. You went through five interviews as well as a battery of psychological tests mandated by their HR de
 

About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape