1 VBScript Session 16. 2 Last time weve learned Regulars Expressions. Methods and properties. How to use the object and his collections. How to create.

Slides:



Advertisements
Similar presentations
TWO STEP EQUATIONS 1. SOLVE FOR X 2. DO THE ADDITION STEP FIRST
Advertisements

1 VBScript Session What we learn last session? Regulars Expressions. Methods and properties. How to use the object and his collections. How to create.
1 VBScript Session What we learn last session?
Sep-05 Slide:1 VBA in Excel Walter Milner. Sep-05 Slide:2 VBA in Excel Introduction VBA = Visual Basic for Applications Enables end-user programming In.
Insert complete company name Creating an Excel Spreadsheet Using Excel 2000.
Copyright © 2011, Elsevier Inc. All rights reserved. Chapter 5 Author: Julia Richards and R. Scott Hawley.
1 Copyright © 2010, Elsevier Inc. All rights Reserved Fig 2.1 Chapter 2.
By D. Fisher Geometric Transformations. Reflection, Rotation, or Translation 1.
Business Transaction Management Software for Application Coordination 1 Business Processes and Coordination.
Excel Object Model.
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Title Subtitle.
0 - 0.
ALGEBRAIC EXPRESSIONS
DIVIDING INTEGERS 1. IF THE SIGNS ARE THE SAME THE ANSWER IS POSITIVE 2. IF THE SIGNS ARE DIFFERENT THE ANSWER IS NEGATIVE.
MULTIPLYING MONOMIALS TIMES POLYNOMIALS (DISTRIBUTIVE PROPERTY)
ADDING INTEGERS 1. POS. + POS. = POS. 2. NEG. + NEG. = NEG. 3. POS. + NEG. OR NEG. + POS. SUBTRACT TAKE SIGN OF BIGGER ABSOLUTE VALUE.
SUBTRACTING INTEGERS 1. CHANGE THE SUBTRACTION SIGN TO ADDITION
MULT. INTEGERS 1. IF THE SIGNS ARE THE SAME THE ANSWER IS POSITIVE 2. IF THE SIGNS ARE DIFFERENT THE ANSWER IS NEGATIVE.
Addition Facts
1 Learning Touchmath *Graphics taken from
1B40: Data analysis 1 Objects Visual Basic is an (OO) object-oriented language. Performing a task in Visual Basic (VB) or.
ZMQS ZMQS
Richmond House, Liverpool (1) 26 th January 2004.
BT Wholesale October Creating your own telephone network WHOLESALE CALLS LINE ASSOCIATED.
Report Card P Only 4 files are exported in SAMS, but there are at least 7 tables could be exported in WebSAMS. Report Card P contains 4 functions: Extract,
1. 2 File 1-Excel Training Part 1 Where number1, number2 are 1 to 30 numeric arguments. Arguments can either be numbers, ranged names or ranges of cell.
ABC Technology Project
Excel Lesson 9 Applying Advanced Formats to Worksheets
1 An Introduction to Pivot Tables Using Excel 2000.
INSERT BOOK COVER 1Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall. Exploring Microsoft Office Excel 2010 by Robert Grauer, Keith.
Pivot Tables Overview 1. What are Pivot Tables Pivot tables in Excel are a versatile reporting tool that makes it easy to extract information from large.
Pasewark & Pasewark Microsoft Office 2003: Introductory 1 INTRODUCTORY MICROSOFT EXCEL Lesson 2 – Changing the Appearance of a Worksheet.
© S Haughton more than 3?
Twenty Questions Subject: Twenty Questions
Chapter 5 Microsoft Excel 2007 Window
Squares and Square Root WALK. Solve each problem REVIEW:
David Walker Ottawa TMG Users Group 15 March 2014.
Lets play bingo!!. Calculate: MEAN Calculate: MEDIAN
Past Tense Probe. Past Tense Probe Past Tense Probe – Practice 1.
Collin College Credit Exam
Chapter 5 Test Review Sections 5-1 through 5-4.
GG Consulting, LLC I-SUITE. Source: TEA SHARS Frequently asked questions 2.
Addition 1’s to 20.
Pasewark & Pasewark Microsoft Office XP: Introductory Course 1 INTRODUCTORY MICROSOFT EXCEL Lesson 7 – Working with Multiple Worksheets.
25 seconds left…...
MS- Excel Spread sheet Program Component of MS-Office suite Performs Calculations, Maintaining Databases and Summary Reports Graphs.
Test B, 100 Subtraction Facts
Week 1.
We will resume in: 25 Minutes.
Computer Concepts BASICS 4th Edition
Excel Lesson 15 Working with Auditing and Analysis Tools Microsoft Office 2010 Advanced Cable / Morrison 1.
1 Unit 1 Kinematics Chapter 1 Day
How Cells Obtain Energy from Food
Excel Lesson 13 Using Powerful Excel Functions Microsoft Office 2010 Advanced Cable / Morrison 1.
Using the Import Accounting Line Feature You may enter accounting lines one by one in KFS or may enter multiple accounts at once using the Import Accounting.
Benchmark Series Microsoft Excel 2010 Level 1
® Microsoft Office 2010 Excel Tutorial 1: Getting Started with Excel.
Modeling using VBA. Covered materials -Userforms -Controls -Module -Procedures & Functions -Variables -Scope.
EXCEL VBA 101 Current Status Waiting Using Excel/VBA to Speed-up Daily Data Processing An Introduction to VBA Yongjun Chen Click Me to Start …
VBA Lab 2 I ns.Samia Al-blwi. Visual Basic Grammar Object: Visual Basic is an object-oriented language. This means that all the items in Excel are thought.
® Microsoft Office 2010 Excel Tutorial 1: Getting Started with Excel.
Working with Formulas Formula – An expression that returns a value – Written using operators that combine different values, resulting in a single displayed.
PERFORMING CALCULATIONS Microsoft Excel. Excel Formulas A formula is a set of mathematical instructions that can be used in Excel to perform calculations.
Spreadsheets What is Excel?. Objectives 1. Identify the parts of the Excel Screen 2. Identify the functions of a spreadsheet 3. Identify how spreadsheets.
Excel Part 2 Beth McKelvey. AutoSum The function in Excel that calculates the sum of a group of numbers.
Microsoft Excel.
Microsoft Excel Basic Skills
Microsoft Excel 101.
Presentation transcript:

1 VBScript Session 16

2 Last time weve learned Regulars Expressions. Methods and properties. How to use the object and his collections. How to create complex patterns.

3 Subjects for session 16 Microsoft Excel Object Model. Workbooks and Worksheets Ranges and Cells. Worksheet Functions.

4 Microsoft Excel Object Model

5

6 Workbooks Use the Workbooks property of the Excel.Application object to return the Workbooks collection. Dim objAppXL Set objAppXL = CreateObject( Excel.Application ) objAppXL.Visible = False With objAppXL.Workbooks.Add --- Create an new empty workbook..Open bugs.xls --- Open an existing workbook..Close --- Close all open workbook. End With objAppXL.Quit Set objAppXL = Nothing

7 Workbooks Use the Workbooks collection with an index or a name to reference a workbook. --- Set focus on the firstopened/created workbook. objAppXL.Workbooks(1).Activate --- Set focus on the bugs.xls workbook. objAppXL.Workbooks(bugs.xls).Activate You can also use the ActivateWorkbook property. --- Set focus on the firstopened/created workbook. objAppXL.Workbooks(1).Activate objAppXL.ActiveWorkbook.Author = Dani V.

8 Workbooks Use the Workbook – Example objAppXL.Workbooks.Open \\zeppo\FT_QA\bugs.xls objAppXL.Workbooks.SaveAs C:\bugs_local.xls objAppXL.ActiveWorkbook.Close objAppXL.Workbooks.Add.Activate objAppXL.ActiveWorkbook.Subject = sales 2004

9 WorkSheets Use the Worksheets property of the workbook collection to return the Worksheets collection. --- Show the number of worksheets in the workbook. MsgBox objAppXL.ActiveWorkbook.Worksheets.Count

10 WorkSheets Use the Worksheets collection with an index or a name to reference a worksheet. --- Activate, print and save the first worksheet objAppXL.ActiveWorkbook.Worksheets(1).Activate objAppXL.ActiveWorkbook.Worksheets(1).PrintOut objAppXL.ActiveWorkbook.Worksheets(1).SaveAs x.xls --- Delete, the Sheet 3 worksheet objAppXL.ActiveWorkbook.Worksheets(Sheet3).Delete You can also use application objects ActivateWorksheet property --- Set focus on the first opened/created workbook objAppXL.ActiveWorkbook.Worksheets(1).Activate objAppXL.ActiveWorksheet.PrintOut

11 Worksheets Use the Worksheet – Example Dim objWshXL Set objWshXL = objAppXL.ActiveWorkbook.Worksheets(1) --- Perform a calculation. objWshXL.Range(A1:A3) = 1 objWshXL.Range(A4) = =Sum(A1:A3) objWshXL. PrintOut

12 Ranges and Cells You may want to reference cells or a range of cells for doing something such entering a formula or changing the format. A Range can be also a single cell. Example --- Show the number of worksheets in the workbook. objWshXL.Range(A1:A3).Font.Bold = True

13 Ranges and Cells Range( A1 )Cell A1. Range( A1:B5 )Cells A1 thorough B5. Range( C5:D9,G9:H16 )A multiple area selection. Range( A:A )Column A. Range( 1:1 )Row 1. Range( A:C )Column A thorough C. Range( 1:5 )Rows 1 thorough 5. Range( 1:1,3:3,8:8 )Rows 1,3, and 8. Range( A:A,C:C,F:F )Columns A,C, and

14 Ranges and Cells Referencing cells: --- Show the number of worksheets in the workbook. objWshXL.Cells(6,1) = 10 objWshXL.Range(A6) = 10 Dim i For i = 1 to 20 objWshXL.Cells(i,3) = i Next

15 Ranges and Cells Referencing cells: --- Show the number of worksheets in the workbook. objWshXL.Cells(6,1) = 10 objWshXL.Range(A6) = 10 Dim i For i = 1 to 20 objWshXL.Cells(i,3) = i Next

16 Ranges and Cells Referencing rows and columns: Rows(1)Row one. RowsAll the rows on the worksheet. Columns(1)Column one. Columns(A)Column one. ColumnsAll the columns in the worksheet. Example --- Setting the fone of first row to be bold. objWshXL.Rows(1).Font.Bold = True

17 Ranges and Cells Referencing a named range: --- Font all range cells red color. objWshXL.Range(salaries).Font.Color = RGB(255,0,0) Referencing all cells: --- Clear all worksheets cells. objWshXL.Cells.ClearContents

18 Ranges and Cells Looping through a range of cells: --- Go over all cells in a range. For Each c In objWshXL.Range(A1:D10).Cells if Abs(c.Value) = 0.01 Then c.Value = 0 Next Selecting cells: objWshXL.Range(A1).Select objWshXL.ActiveCell = Hello objWshXL.Range(A1) = Hello

19 Ranges and Cells Useful methos and properties MethodsProperties ActivateCells CheckSpellingColumns ClearRows ClearContentFont ClearFormatsFormula CopyStyle CutValue Paste Delete Replace Select Sort

20 Ranges and Cells Used as a container for Microsoft Excel worksheet functions that can be called from VBScript. Example: --- Find the minimum value within a range. Dim theRange, minVal Set theRange = objWshXL.Range(A1:C10) minVal = objAppXL.WorksheetFunction.Min(theRange) MsgBox The minimum is: & minVal

21 Ranges and Cells Useful worksheets functions Methods Count Max Min Sum And Or Power Round StDev Average Pi And Many More

Make sure to visit us Tutorials Articles Proikects And much more 22