Trending February 2024 # Vbscript Functions & Procedures With Example # Suggested March 2024 # Top 10 Popular

You are reading the article Vbscript Functions & Procedures With Example updated in February 2024 on the website Tai-facebook.edu.vn. We hope that the information we have shared is helpful to you. If you find the content interesting and meaningful, please share it with your friends and continue to follow and support us for the latest updates. Suggested March 2024 Vbscript Functions & Procedures With Example

In this tutorial, you will learn-

VBScript Procedures

VBScript procedures are used mainly for code organization and reuse. We have been using simple examples till now as here the purpose is learning VBScript. But in real-world scenario, the code is not as simple as that. When you try to implement something that is useful, the code might get more complex. There could be hundreds of lines stretching across many pages.

If you do not organize the code properly, the whole process of coding, debugging and managing the code will become really complex. So, you should organize or modularize the code carefully so that your code becomes easily manageable.

Moreover, suppose you have a set of statements that performs a particular action. You want the same action to be repeated several times. Then, why should you write the same code again and again? By using effective techniques, you can make your code reusable. This will help the developers to organize the code beautifully and the testers to identify bugs easily. In short, code modularization and reuse is very important for making the code more powerful, reliable, and easier to maintain. Here come procedures into a picture.

Types of Procedures in VBScript

A procedure is a block of code that ideally performs a single function. A block of code that processes an input or handles a file is a good example of a function. There are two types of procedures in VBScript.

Sub procedure: The sub-procedure does not return a value.

Function procedure: The function procedure is used if you want to return a value.

Sub Procedures:

If you want to execute a series of statements without returning any value, then you can use sub procedures.

Sub procedures start and end with Sub and End Sub statements respectively. Sub procedures can take arguments, but cannot return a value. Sub procedures may or may not take input.

Sub outputMessage() document.write("Welcome") End Sub

Just writing this code will not output anything. Here you have created a Sub procedure named outputMessage. Next, you need to call it.

call outputMessage()

Sub outputMessage() document.write(“Welcome”) End Sub call outputMessage()

The output of this code will be

VBScript Functions

If you want to execute a series of statements and return a value, then you need to use function procedures, commonly known as function.

Function procedures start and end with Function and End Function statements respectively.

A function procedure may or may not take input.

Function procedures return a value by assigning the value to its name.

Function findArea(radius) const pi=3.14 area = pi*radius*radius findArea = area End Function document.write(“The area of the circle when the radius is 10 is ” & findArea(10))

The output of this code will be

ByRef and ByVal Parameters

You can pass VBScript arguments to the procedures by reference or by value.

If you do not specify anything when you call a procedure, then the argument/arguments are passed by reference by default.

If you the changes made to the arguments to persist even after the procedure is called, then you need to pass the VBScript arguments by reference.

When an argument is passed by value, any changes that the called procedure makes to the value of the variable do not persist after the procedure is called.

The keywords ByRef and ByVal are used to pass arguments by reference and by value respectively.

To understand the difference, first, execute the given below code and see the output.

Step 1) Copy the code into your editor

Function returnResult(ByRef value) value = value +1 returnResult = value End Function Dim x x=5 call returnResult(x) document.write(x)

Step 2) the output is 6.

Step 3) Change Function returnResult(ByRef value) to Function returnResult(ByVal value)

Step 4) Now your output will be 5.

Summary

VBScript procedures are used mainly for better code organization and reuse.

There are two types of VBS procedures: Sub procedures and Function procedures.

If you want to execute a series of statements without returning any value, then you can use sub procedures.

If you want to execute a series of statements and return a value, then you need to use function procedures.

You can pass arguments to the procedures by reference or by value. Arguments are passed by reference by default.

If you want to make the changes happened to the arguments persist even after the procedure is called, then you need to pass the arguments by reference and otherwise by value.

You're reading Vbscript Functions & Procedures With Example

Airport Authority: Meaning And Functions

The Airports Authority of India (AAI) was established on April 1, 1995, by an Act of Parliament under the Airports Authority of India Act, 1994, by combining the former National Airports Authority and the International Airports Authority of India. As a result of the merger, a single organization was formed with the responsibility for developing, improving, managing, and overseeing the nation’s civil aviation infrastructure, both on the ground and in the air.

The Indian Airports Authority is headquartered in New Delhi. AAI is in charge of 125 airports, including 26 civil enclaves on military bases, 07 customs airports, 18 international airports, 78 domestic airports, and 18 customs airports. The AAI is in charge of developing, improving, maintaining, and managing India’s civil aviation infrastructure. The main duty of the AAI is to provide Air Traffic Management (ATM) services over the airspace of the Indian Territory and the nearby marine areas.

Airport Authority of India

Section 3 provides for the establishment of the Airports Authority of India, which states that the Central Government shall, by notification in the Official Gazette, establish an authority to be known as the Airports Authority of India.

The Authority shall consist of

A Chairperson to be appointed by the Central Government;

Ex officio appointment by the Central Government of the Director General of Civil Aviation or an officer not lower in rank than the Deputy Director General of Civil Aviation;

The Central Government will appoint not less than eight and no more than fourteen members.

Section 4 provides for disqualification, and a person is disqualified from being appointed as a member if he- or she −

Has been convicted and sentenced to imprisonment for an offense involving moral turpitude in the opinion of the Central Government; or

Is an undischarged insolvent; or

Is of unsound mind and has been declared as such by a competent court; or

Has been removed or dismissed from the Government’s or a body corporate owned or controlled by the Government’s service; or

Has a financial or other interest in the Authority that, in the opinion of the Central Government, is likely to impair the performance of his duties as a member.

Functions of the Authority

Section 12 of the Act provides for the functions of the authority and accordingly, some of the functions of the authority are as follows −

It is the responsibility of the Authority to effectively manage airports, civil enclaves, and aeronautical communication stations, subject to any rules made in this regard by the Central Government.

At any airport and in civil enclaves, the Authority shall be responsible for providing air traffic service and air transportation service.

Plan, develop, build, maintain, and repair airport runways, taxiways, aprons, terminals, and auxiliary structures;

Provide any technical, financial, or other assistance that the Central Government may deem necessary for such a purpose in order to establish airports or assist in the establishment of private airports.

Plan, acquire, install, and maintain ground aids, communication tools, beacons, and navigational aids at airports and other locations deemed necessary for the safe operation and navigation of aircraft;

In coordination with other agencies, offer facilities for search and rescue and air safety services;

Establish institutions, schools, or training facilities for its officers and staff to receive training in any area related to the goals of this Act;

Constructing a residential complex for its employees;

Establish and operate hotel rooms, restaurants, and restrooms at or close to airports;

Establish cargo complexes and warehouses at the airports for the processing and storage of goods;

Establish facilities for postal, money exchange, insurance, and telephone use by travelers and other people at airports and civil enclaves;

Make suitable preparations for watch and ward at the civil enclaves and airports;

Establish and manage heliports and airstrips;

Perform any additional tasks that the Central Government deems desirable or necessary for ensuring the safe and effective operation of aircraft into, out of, and through Indian airspace;

Establish workshops and training facilities

Conclusion

The Airport Authority of India, a significant organization, has a significant influence on the development of civil aviation in India. The AAI, a Ministry of Civil Aviation department, is in charge of managing, developing, and maintaining airports in India.

Frequently Asked Questions

Q1. What is the Airport Authority of India (AAI)?

Ans. The Airport Authority of India (AAI) is a statutory body responsible for the management and operation of airports in India. It was created by the Airport Authority of India Act, of 1994.

Q2. What is the objective of the Airport Authority of India?

Ans. The main objective of the Airport Authority of India is to provide safe, secure, efficient, and cost-effective air navigation services to aircraft in Indian airspace.

Q3. What are the functions of the Airport Authority of India?

Ans. The Airport Authority of India is responsible for the management, operation, maintenance, and development of civil aviation infrastructure in India, including airports, air traffic services, communication and navigation aids, and other aviation-related

Q4. What is the role of the Airport Economic Regulatory Authority (AERA) concerning the Airport Authority of India?

Ans. The Airport Economic Regulatory Authority (AERA) is responsible for determining and regulating the tariffs for aeronautical services provided by the Airport Authority of India.

Best Powerpoint Features And Functions To Use For Presentations

Those who perform presentations on a regular basis using Microsoft PowerPoint need to learn the best methods to deliver a presentation to make things more streamlined and professional. The platform offers everything you need to impress whoever is watching, you just need knowledge of what to do. In this article, we are going to discuss the best Microsoft PowerPoint tools, features, and functions for delivering a presentation. When you’re done reading, you’ll certainly become a master presenter, so be sure to remember us whenever that promotion becomes a reality.

From our point of view, language and how clearly a person presents a presentation are the most important tools. The visual aspect is key, this is true, but if you’re not able to explain what is on screen, then your presentation has effectively failed.

Best PowerPoint features and functions to use for presentations

If you’re looking for some great PowerPoint tools, features and functions to use during your presentations, then here’s our list:

Use the Cameo feature

Use the PowerPoint Presenter View

Use the Zoom feature

Use the Subtitles feature

Practice with Presenter Coach

1] Use the Cameo feature

If you want to learn how to add a live camera feed via the Cameo feature, then we suggest reading our post on how to add live webcam video to a PowerPoint presentation.

Another cool feature to look at here is one called Presenter View. This lets the user view their presentation with speaker notes on one computer, while at the same time the audience views the notes-free presentation from a different computer monitor.

To learn how to get this done, please read: How to view Notes in PowerPoint with Presenter view.

3] Have a look at the Zoom feature

Learn to use the Zoom feature in Microsoft PowerPoint by reading: How to zoom in on Picture during PowerPoint presentation.

4] Use the Subtitles feature

One of the best features that have long been overlooked during a PowerPoint presentation, is the Subtitles feature. It is capable of converting spoken words into text for those who have certain impairments.

Not only that, but this feature is capable of translating spoken words into a different language. It’s quite impressive, hence why it must be part of every presenter’s arsenal.

If you’re interested to learn more, please go on ahead and read: Presentation Translator: Add live subtitles and translate presentations.

5] Practice with the Presenter Coach

Not everyone is a master at delivering the perfect presentation. In a situation like this, your best bet is to practice before going live. If you do not have another person to help you out, then the Presenter Coach is your best friend here.

It will give you feedback on your performance in real time, so you will always know if you’re on the right track.

Learn how to effectively use Presenter Coach by reading: How to use Presenter Coach in Microsoft PowerPoint Online.

What is the most important part of a PowerPoint?

The most important part of a presentation is the introduction because it sets the tone for the entire event. Its main purpose is to grab the attention of the audience, usually within the first 15-20 seconds. Ensure the first few words make an impact since failure to do this could destroy the rest of the presentation.

READ: How to save animated GIFs from PowerPoint.

11 New Analytical Functions In Google Sheets For 2023

Coming hot on the heels of last year’s batch of new lambda functions, Google recently announced another group of new analytical functions for Sheets.

Included in this new batch are the long-awaited LET function, 8 new array manipulation functions, a new statistical function, and a new datetime function.

Let’s begin with a look at the new array functions. The LET function is at the end of the post.

New Array Manipulation Functions

Although there are eight new array manipulation functions, you can think of them as four pairs of horizontal/vertical array functions.

Although most of this behavior was already possible with existing functions, these new functions simplify the syntax and are therefore a welcome upgrade. They also maintain function parity with Excel, which will help folks coming from that world.

TOROW Function

TOROW transforms a range into a single row.

This formula turns the input array in A1:C2 into a single row:

=TOROW(

A1:C2

)

It has optional arguments that determine how to handle blank cells or error values, and also whether to scan down columns or across rows when scanning the input range.

More information in the Google Documentation.

TOCOL Function

The TOCOL function transforms a range into a single column. It behaves in the same way as the FLATTEN function.

This formula in cell A5 transposes each row into a column format and puts them one atop another:

=TOCOL(

A1:C2

)

Like the TOROW function, it has optional arguments that determine how to handle blank cells or error values, and also whether to scan down columns or across rows when scanning the input range.

More information in the Google Documentation.

CHOOSEROWS Function

Given a range of data, the CHOOSEROWS function lets you select rows by row number.

For example, this formula selects the first, second, and fourth rows:

=CHOOSEROWS(

A1:C5

,

1

,

2

,

4

)

This can also be achieved, of course, by the FILTER function or the QUERY function. However, this new function is a nice, lightweight alternative for when you know the row numbers and don’t need to perform a conditional test on each row.

More information in the Google Documentation.

CHOOSECOLS Function

CHOOSECOLS is a welcome addition to the function family.

It lets you select specific columns from a range, which previously required a QUERY function and was more awkward because you use letter references for the columns.

This example selects the first and third columns from the input range:

=CHOOSECOLS(

A1:C5

,

1

,

3

)

More information in the Google Documentation.

WRAPROWS Function

WRAPROWS takes a 1-dimensional range (a row or a column) and turns it into a 2-dimensional range by wrapping the rows.

It takes three arguments: 1) an input range, 2) a wrap count, which is the maximum number of elements in the new rows, and 3) a pad value, to fill in any extra cells.

In this example, the formula wraps the first row into multiple rows with a max of two elements on each row. Notice the second comma in the formula. This sets the pad value to blank, which means cell B8 is blank.

=WRAPROWS(

A1:I1

,

2

,)

More information in the Google Documentation.

WRAPCOLS Function

WRAPCOLS takes a 1-dimensional range (a row or a column) and turns it into a 2-dimensional range by wrapping the columns.

It takes three arguments: 1) an input range, 2) a wrap count, which is the maximum number of elements in the new columns, and 3) a pad value, to fill in any extra cells.

In this example, the formula wraps the first row into multiple columns with a max of two elements down each column. Notice the second comma in the formula. This sets the pad value to blank, which means cell E4 is blank.

=WRAPCOLS(

A1:I1

,

2

,)

More information in the Google Documentation.

VSTACK Function

The VSTACK function stacks ranges of data vertically.

For example, you could VSTACK to easily combine two (or more) datasets:

=VSTACK(

A1:B5

,

D2:E5

)

It takes the data in the range A1:B5 (which includes a header row) and appends the data from D2:E5 underneath, so you have it all in a single table:

More information in the Google Documentation.

HSTACK Function

HSTACK combines data ranges horizontally.

For example, this formula in A14 combines three data ranges horizontally:

=HSTACK(

A1:A5

,

C3:C7

,

A7:A11

)

More information in the Google Documentation.

Margin Of Error Function

The MARGINOFERROR function calculates the margin of error for a range of values for a given confidence level.

It takes two arguments: 1) the range of values, and 2) the confidence level.

Let’s use this dataset as an example:

The MARGINOFERROR function is:

=MARGINOFERROR(

C2:C11

,

0.99

)

which calculates the margin of error at a confidence level of 99%:

This is perhaps easier to understand on a chart, showing the margin of error bars (1 standard deviation) and the mean value (red line):

More information in the Google Documentation.

Epoch To Date Function

EPOCHTODATE converts a Unix epoch timestamp to a regular datetime (in Univerasal Coordinated Timezone, UTC).

It takes two arguments: 1) the Unix epoch timestamp, and 2) an optional unit argument.

A Unix timestamp looks like this:

1676300687

The EPOCHTODATE Function takes this as an input (e.g. the Unix timestamp is in cell A1 in this example):

=EPOCHTODATE(A1)

The output of the function is:

2/13/2023 15:04:47

More information in the Google Documentation.

LET Function

The LET function lets you use defined named variables in your formulas. It’s a powerful technique that reduces duplicate expressions in your formulas.

LET Example 1

Consider this LET example, which categorizes the total sales using an IFS function.

The LET function allows us to define a “sales” variable that references the SUM of sales in column C. We can reuse the variable “sales” anywhere else in this formula:

Without LET, the formula repeats the SUM expression repeatedly, which makes changing this formula more difficult:

LET Example 2

This formula — using LET, SEQUENCE, and FILTER — will get all the weekdays (Monday – Friday) for the year ahead, starting from today:

=LET( dates , SEQUENCE(

365

,

1

,TODAY(),

1

) , FILTER( dates , WEEKDAY(dates,

2

)6 ))

By using LET, you can avoid repeating the SEQUENCE expression.

More information in the Google Documentation.

16 Simple, Yet Powerful Excel Functions You Need To Know

Power users love to talk about how powerful and awesome Excel is, what with its Pivot Tables, nested formulas, and Boolean logic. But many of us barely know how to find the Autosum feature, let alone use Excel’s functions to create powerful formulas.

=SUM()

The first function anyone should know tells Excel to carry out basic arithmetic. Let’s say you wanted the numbers in cell A2 and cell B2 to be added together in cell C2. All you’d do is enter =SUM(A2:B2) into C2, then hit Enter. In an instant you’d see sum of the two cells appear.

You can use this function, and most of the functions listed here, to encompass as many cells as you require. You can also select them with your mouse, but I find it’s far easier to type in a range of cells. 

=AVERAGE()

Average does exactly what it says, and works similarly to SUM. If you have a worksheet containing your monthly earnings over the past year in columns A2 through A13, type =AVERAGE(A2:A13) into A14 to get the average of all monthly earnings.

=MEDIAN()

The median and the average are often confused, but they are not the same thing. The median takes a group of numbers such as (in our example below) 2, 6, 15, 31, and 56, and figures out the middle point of the group. In other words, half the numbers are above the median, and half are below. We’ve compared the median to the average in the screenshot to show you the difference. 

Melissa Riofrio/IDG

Average and median are often confused, but this example shows how the average represents a sum of numbers divided by their quantity. The median represents a middle point in the series of numerals, regardless of how they add up.

=MIN()

If you need to find the smallest number in a range of cells, MIN can help you do that. Using =MIN(B3:B39) will give you the smallest number contained in those cells.

=MAX() =TRIM()

If you’re looking to clean up line breaks, try CLEAN instead of TRIM.

=COUNT()

If you need to know how many cells in a given range contain numbers, don’t bother counting by hand—just use the COUNT function. If you have a mix of numbers and text in cells A21-A50, for example, type into cell A51 =COUNT(A21:50) and you’ll have the answer in no time. 

Melissa Riofrio/IDG

=COUNTA()

Similar to the above example, you can use =COUNTA() to count the number of cells in a given range that contain characters such as numbers, text, or symbols, as well as error values.

=LEN() =CONCATENATE()

This takes data from two cells and turns it into one. Check out our previous look at Excel functions to see how this can be useful.

=DAYS() =NETWORKDAYS()

IDG

Calculating the weekdays in 2023.

Knowing the number of days is great, but if you need to know how many weekdays that range encompasses, turn to NETWORKDAYS (that’s ‘net work days’) instead. This function uses the same format as DAYS, but you need to use an ascending cell order to get a non-negative number. So =NETWORKDAYS(A4, A5) will give you 80 and not -80.

=SQRT() =NOW()

Want to see the current date and time whenever you open a particular worksheet? Type =NOW() into the cell where you want the date and you’re done. If you want to see a future date from right now, you can use something like =NOW()+32. The now function does not take any arguments so don’t put anything in between the brackets.

=ROUND()

As its name suggests, this function lets you round off numbers. ROUND requires two arguments: a number or cell, and the number of digits to round to. If you have the number 231.852645 in A1, for example, =ROUND(A1, 0) gives you 232, =ROUND(A1, 1) gives you 232.9, and =ROUND(A1, -1) returns 230.

=ROUNDUP(), =ROUNDDOWN()

If you want more direct control over rounding up or down there are functions for that too. ROUNDUP and ROUNDDOWN use exactly the same argument format as ROUND. To learn more about round and its counterparts, check out Microsoft’s support pages.

Vbscript Functions & Procedures With Example

In this tutorial, you will learn-

VBScript Procedures

VBScript procedures are used mainly for code organization and reuse. We have been using simple examples till now as here the purpose is learning VBScript. But in real-world scenario, the code is not as simple as that. When you try to implement something that is useful, the code might get more complex. There could be hundreds of lines stretching across many pages.

If you do not organize the code properly, the whole process of coding, debugging and managing the code will become really complex. So, you should organize or modularize the code carefully so that your code becomes easily manageable.

Moreover, suppose you have a set of statements that performs a particular action. You want the same action to be repeated several times. Then, why should you write the same code again and again? By using effective techniques, you can make your code reusable. This will help the developers to organize the code beautifully and the testers to identify bugs easily. In short, code modularization and reuse is very important for making the code more powerful, reliable, and easier to maintain. Here come procedures into a picture.

Types of Procedures in VBScript

A procedure is a block of code that ideally performs a single function. A block of code that processes an input or handles a file is a good example of a function. There are two types of procedures in VBScript.

Sub procedure: The sub-procedure does not return a value.

Function procedure: The function procedure is used if you want to return a value.

Sub Procedures:

If you want to execute a series of statements without returning any value, then you can use sub procedures.

Sub procedures start and end with Sub and End Sub statements respectively. Sub procedures can take arguments, but cannot return a value. Sub procedures may or may not take input.

Sub outputMessage() document.write("Welcome") End Sub

Just writing this code will not output anything. Here you have created a Sub procedure named outputMessage. Next, you need to call it.

call outputMessage()

Sub outputMessage() document.write(“Welcome”) End Sub call outputMessage()

The output of this code will be

VBScript Functions

If you want to execute a series of statements and return a value, then you need to use function procedures, commonly known as function.

Function procedures start and end with Function and End Function statements respectively.

A function procedure may or may not take input.

Function procedures return a value by assigning the value to its name.

Function findArea(radius) const pi=3.14 area = pi*radius*radius findArea = area End Function document.write(“The area of the circle when the radius is 10 is ” & findArea(10))

The output of this code will be

ByRef and ByVal Parameters

You can pass VBScript arguments to the procedures by reference or by value.

If you do not specify anything when you call a procedure, then the argument/arguments are passed by reference by default.

If you the changes made to the arguments to persist even after the procedure is called, then you need to pass the VBScript arguments by reference.

When an argument is passed by value, any changes that the called procedure makes to the value of the variable do not persist after the procedure is called.

The keywords ByRef and ByVal are used to pass arguments by reference and by value respectively.

To understand the difference, first, execute the given below code and see the output.

Step 1) Copy the code into your editor

Function returnResult(ByRef value) value = value +1 returnResult = value End Function Dim x x=5 call returnResult(x) document.write(x)

Step 2) the output is 6.

Step 3) Change Function returnResult(ByRef value) to Function returnResult(ByVal value)

Step 4) Now your output will be 5.

Summary

VBScript procedures are used mainly for better code organization and reuse.

There are two types of VBS procedures: Sub procedures and Function procedures.

If you want to execute a series of statements without returning any value, then you can use sub procedures.

If you want to execute a series of statements and return a value, then you need to use function procedures.

You can pass arguments to the procedures by reference or by value. Arguments are passed by reference by default.

If you want to make the changes happened to the arguments persist even after the procedure is called, then you need to pass the arguments by reference and otherwise by value.

Update the detailed information about Vbscript Functions & Procedures With Example on the Tai-facebook.edu.vn website. We hope the article's content will meet your needs, and we will regularly update the information to provide you with the fastest and most accurate information. Have a great day!