The Crazy Helpdesk by Tanja Peikert - HTML preview

PLEASE NOTE: This is an HTML preview only and some elements such as links or page numbers may be incorrect.
Download the book in PDF, ePub, Kindle for a complete version.

Totals or Titles.” To emphasise this Hilde put her cursor on the number right to ‘Food’

in Sheet2.

Food

564.358,00

She then chose ‘Insert - Name - Define’’ and Excel politely suggested the right name:

‘Food’. She clicked Ok on that. She went over to Sheet1 and just typed:

=Food

And the total expenses for Food this year appeared. Hilde really likes to eat a lot... but not that much either. This is just an example. Excel was food for her spirit.

Hilde was now completely satiated or high or drunk on all this, even if remaining her

own sober self, but Reinhardt had gotten a hiccup.

- 324 -

index-325_1.png

The Crazy HelpDesk

Lovely code

A good programmer always chooses the shortest and easiest way. In truth a good

programmer only wants to lean back and do nothing. Even if he loves to programme.

Programming is a very pleasant activity. People don’t realise about programmes,

scripts or even ‘simple’ macros. It’s unbelievable, what you can do. In fact you can

make a macro do just about anything. You can ask a programme to do almost

everything that you do all over again and again. Typically a programme can execute in

one stroke an action that you repeat several times a day or week. Make a macro out of

it and it will spare you hours, weeks, months of time. But in order to witness a miracle one has to wish for it first. The difficulty is that it is not always easy to see what you can wish for. But if you have found out, just wish, ask your programmer, and insist

until he gives you what you want.

Nico, harassed by Chiara, had finally decided to try to give her at least an inkling of all this. Since she was wishing. She bent over his shoulder eagerly, her long dark hair

falling on his back. OK usually it was Hilde or Gwendoline who did the Word macros,

but since Chiara stared at him so adoringly. She did have beautiful eyes. He felt her

soft breath in his neck, eager, a pleasurable scent surrounded her.

“Imagine you must make a page in landscape format very often, and then go back to portrait. Portrait, Landscape, Portrait.”

On this, Nico pictured the landscapes he had seen along his travels around the world.

“Or that you have to do a Footer with a page number and your name in it to the left and

the documents name to the right.”

(Of course then you have to know that you can insert the documents name by choosing

‘Insert - Field - Document Information - Filename’)

It is quite a job to do this each time, but not if you use a macro.

Imagine anything. A macro is useful for every kind of action you have to repeat a lot.

- 325 -

index-326_1.png

The Crazy HelpDesk

Something you do everyday, or something you must do a thousand times throughout a

document.

Macros

First Choose ‘Tools - Macro - Record New Macro - Give it a Name’’.

The macro recorder will appear:

Now begin doing the keystrokes; just as you would normally do.

When you’re done click on the little square to stop recording the macro.

Then press Alt+F11 to open the Visual Basic Editor. In the list of the left panel click on Normal, then on New Macros. There is your macro.

You can change the parameters in it, like the margins for your landscape page and then

save the macro.

To use it again choose ‘Tools - Macro - and find your Macro in the list.’

Try it with the portrait-landscape Macro, setting the margins on the landscape page

very small, so that you can put a large table in it.

 Choose Tools - Macro - Record Macro

 Give it a name like ‘Landscape’

 Insert - Break - Section Break - Next Page

 Type one Return character

 Again: Insert - Break - Section Break - Next Page

 Go on the page you want in landscape format

 Choose File - Page Setup

 Click on the Paper Size tab

 Choose Landscape

 Then click on the Margins tab

 Set the margins to 0,40 inches everywhere (or 1 cm)

 Close this dialog box

 Click on the little square to stop recording.

The macro is done, have a look at it:

 Press Alt+F11 to open the Visual Basic Editor

 On the left panel find ‘Normal’ and there ‘New Macros’

Here is your macro:

- 326 -

The Crazy HelpDesk

Sub landscape()

' Macro recorded 21/08/2004 by Nico

Selection.TypeParagraph

Selection.InsertBreak Type:=wdSectionBreakNextPage

Selection.TypeParagraph

Selection.InsertBreak Type:=wdSectionBreakNextPage

Selection.MoveUp Unit:=wdLine, Count:=1

With Selection.PageSetup

.LineNumbering.Active = False

.Orientation = wdOrientLandscape

.TopMargin = CentimetersToPoints(1)

.BottomMargin = CentimetersToPoints(1)

.LeftMargin = CentimetersToPoints(1)

.RightMargin = CentimetersToPoints(1.28)

.Gutter = CentimetersToPoints(0)

.HeaderDistance = CentimetersToPoints(1.25)

.FooterDistance = CentimetersToPoints(1.25)

.PageWidth = CentimetersToPoints(29.7)

.PageHeight = CentimetersToPoints(21)

‘there is more but that you can see when you recorded the macro

End With

End Sub

 To launch the macro choose ‘Tools - Macro’’ and find the Landscape macro in

the list.

Chiara clapped her hands adoringly: “Oh Nico, this is so exciting. How much such

things can spare time, our precious time. You’re a genius.”

He smiled at her: “That one was easy.”

“Don’t be modest! You’re fantastic. And now I know how to make a Landscape format

too! Show me another one please Nico.”

She smiled at him, eyes fluttering, and Nico thought she was not such a bore after all,

and she was very pretty, with her black hair and kind of Chinese porcelain like

delicacy:

“Imagine you have to make a document several time a week with the lines:

Name:

Phone:

Email Address:

which has to be repeated a specific number of times. Of course you could just copy

those three lines, but I’ll show you the macro just for the principle.”

- 327 -

The Crazy HelpDesk

 Choose Tools - Macro - Record Macro

 Type the three lines.

 Close the macro.

 Open the Macro Editor.

Sub Names()

' Macro recorded 21/08/2004 by Nico

Selection.TypeText Text:="Name:"

Selection.TypeParagraph

Selection.TypeText Text:="Phone:"

Selection.TypeParagraph

End Sub

“Fine. But this will be only once.” She pouted.

Nico looked at her approvingly; maybe she was smarter than he had thought.

Yes! You’ll use what’s called a loop.

Loop

So in order to have it let’s say 150 times we’ll add a loop sequence to the code. Let’s

take out the Email address, to make it shorter. It’s for the principle of it.

Sub Names()

' Macro recorded 21/08/2004 by Nico

For x = 1 to 150

Selection.TypeText Text:="Name:"

Selection.TypeParagraph

Selection.TypeText Text:="Phone:"

Selection.TypeParagraph

next x

End Sub

“And if I want to change that number every time, do I have to go and edit the macro? Is

there a way to have the macro ask a question?”

“Very good Chiara, there is a way indeed!”

“Nico, you’re such a darling!” She seemed to be in a state of excitement he had not yet

observed in a woman.

Nico was beginning to have a good idea about Chiara. And she sure was pretty.

- 328 -

The Crazy HelpDesk

Sub Names()

' Macro recorded 21/08/2004 by Nico

vNumber = InputBox("How many times?",”How many")

For x = 1 to vNumber

Selection.TypeText Text:="Name:"

Selection.TypeParagraph

Selection.TypeText Text:="Phone:"

Selection.TypeParagraph

Selection.TypeParagraph

next x

End Sub

“Nico you’re brilliant.” It was a statement.

She was bending over him and her bosom was trembling. Nico thought that on his next

trip he would like to go to Mexico again. It was such a sunny place.

“And if I want in once in Italian, once in English, is there a way to make the macro

ask?”

Nico nodded, he felt cheerful now. Mexico it would be.

“Yes for that we can use a sequence called:

If-then-else

Well here without the else, though we could use it.”

vNumber = InputBox("How many times?",”HOW MANY")

vLanguage = InputBox("Language? Type e for English and i for Italian",

"LANGUAGE")

If vLanguage = "e" Then

For x = 1 To vNumber

Selection.TypeText Text:="Name:"

Selection.TypeParagraph

Selection.TypeText Text:="Phone:"

Selection.TypeParagraph

Next x

End If

If vLanguage = "i" Then

For x = 1 To vNumber

Selection.TypeText Text:="Nome:"

- 329 -

The Crazy HelpDesk

Selection.TypeParagraph

Selection.TypeText Text:="Telefono:"

Selection.TypeParagraph

Next x

End If

Chiara clapped her hands. So this magic really worked.

“Nico you’re ever so clever.” This rimed.

It’s lunchtime - but only an appointment yet

They decided to have lunch together. Chiara had been waiting for this for months now

and went away glowing with happiness. Of course we can’t know if she had been

waiting for Nico or for a macro. Let’s say it was for both.

Nico decided to make the macro a bit more elegant, but she needn’t to see this too

soon, all of what he could do, and it would only confuse her, because he used a

function now.

Sub Names()

Dim vNumber as Integer

Dim vLanguage as string

vNumber = InputBox("How many times?",”HOW MANY")

vLanguage = InputBox_

("Language? Type ‘en’ for English, ‘it’ for Italian",”LANGUAGE")

If vLanguage = "it" Then

Call FillText("Nome",”Telefono")

End If

If vLanguage = "en" Then

Call FillText("Name",”Phone")

End If

End Sub

Function FillText(vName, vPhone)

For x = 1 To vNumber

Selection.TypeText Text:= vName

Selection.TypeParagraph

Selection.TypeText Text:= vPhone

Selection.TypeParagraph

Selection.TypeParagraph

Next x

End If

- 330 -

index-331_1.png

The Crazy HelpDesk

End Function

Nico began to dream again, about Mexico, and how to visit it, maybe with Chiara.

He made a macro to see how many times the word ‘Chiara’ appeared in the manual and

to highlight Chiara in Red.

Sub HowmanyTimes()

Dim WordSearched As String

WordSearched = "Chiara"

SingleWord = Trim(WordSearched)

WordNum = 0

p = 0

totalwords = ActiveDocument.Words.Count

MsgBox totalwords “ in the document”

For wcount = 1 To totalwords

aword = Trim(ActiveDocument.Words(wcount))

If aword = SingleWord Then

WordNum = WordNum + 1

ActiveDocument.Words(wcount).Select

ActiveDocument.Words(wcount).HighlightColorIndex = wdBrightRed

End If

Next

MsgBox WordSearched " appears " WordNum & " times"

End Sub

That’s the way computer people write love poems. Dim was to ‘declare’ a variable and Trim was necessary because Word didn’t understand a thing. The macro counted

bravely, and then said, as if slightly embarrassed:

Indeed the message box displayed ‘only 7 times’. Only 7! Nico thought he should do

- 331 -

The Crazy HelpDesk

something to increase this number from now on. It was true, what was said about him:

Programmers don’t listen to their users. He would try to amend from now on, and

become more user-friendly.

Chiara was really nice, and she seemed to have a good feeling for programming.

Maybe it could be done, just with a formula, and users would know how to do it. He

wouldn’t show the ‘HowmanyTimes’ macro to Chiara yet, she might not understand,

and in programming he liked it hard. In real life Nico liked it cool. He dreamt of being, maybe with Chiara, on a desert beach, a palm filled beach, a Mexican beach. That was

the way liked to live. Programmers can be lonely hunters, and that’s why you don’t

hear so much about Nico in this manual. Too much lost in codes, like to count how

many times each letter of the Alphabet occurred in this story. He had to use Arrays

there. He could have done the same macro counting how many time all their names

appeared in the story, but he was too lazy, as programmers are, and anyway he had

only wanted to impress Chiara, and he had this one ready.

Sub HowmanyLong()

For cntall = 1 To 26 Step 1

Dim lettarr(26)

Howmany(cntall) = 1

Dim poemarr(100)

Next cntall

Dim Howmany(26)

For cntall = 1 To 26 Step 1

Dim all26

somany = 0

Selection.WholeStory

For cntlet = 1 To poemlen Step 1

Poem = Selection

If lettarr(cntall) = poemarr(cntlet) Then

all26 = "abcdefghijklmnopqrstuvwxyz"

somany = somany + 1

poemlen = Len(poem)

End If

somany = 0

Next cntlet

For count = 1 To 26 Step 1

Howmany(cntall) = somany

lettarr(count) = Mid(all26, count, 1)

Next cntall

Next count

For cntall = 1 To 26 Step 1

For countp = 1 To poemlen Step 1

Selection.TypeText Text:=lettarr(cntall) & "

poemarr(countp) = Mid(poem, countp, 1)

appears " + Str(Howmany(cntall)) + " times"

Next countp

Selection.TypeParagraph

‘ctd on next column

Next cntall

End Sub

Some programmers push things even further: they will write a simple programme, in

some four to ten lines, and then they will surround it by ‘dummy code’, sometimes, it’s

hard to say, 1000 more lines a line, like one would dress in beautiful clothes, just to

look better, and the customer would see nothing but the show. But Nico really hadn’t

time for that now; he just wanted Chiara as she had been made by the one who had

programmed her at birth.

But then he startled, and noticed something was weird. He had NOT put the word

“Only” in the Count Chiara macro, he was sure of that. But then who had? He tried it

again, and again the macro said “Only”. But no time to check this further, it was

- 332 -

index-333_1.png

index-333_2.png

index-333_3.png

index-333_4.png

index-333_5.png

index-333_6.png

The Crazy HelpDesk

12h30, time for lunch with Chiara.

For x = 1 to 1000

Selection.TypeText Text:="Chiara "

next x

Careful to leave the blank space after the name, otherwise Word won’t know how to

break lines and mangle it up.

It’s lunchtime - but nothing happens

And after lunch Chiara wrote back:

For x = 1 to 1000000

Selection.TypeText Text:="Thanks! "

next x

She had left the blank space. Nico now decided that Mexico would be as soon as

possible. The next day he sent her a macro by Email:

Sub weekend()

vSail = InputBox("Do you want to come to paddle?!",”CANOE WEEKEND")

If vSail = "yes" Then

MsgBox "Meet at the Lake at 9hoo."

Else

MsgBox "Paddling alone is no fun."

End If

End Sub

and Chiara answered with a document attached which astonished Nico greatly:

But the “Yes!” was jumping around in all senses you could imagine. Moving like hell.

It swell, shrunk, grew bigger, smaller, moved up and down the screen, turned on itself,

distorted, until going back to a simple Yes! You know. What vivacity! However had

she done it!? Nico tried out the Macro himself, but couldn’t figure it out.

WordArt

To begin with Chiara had used WordArt, in Insert - Picture - WordArt -

- 333 -

index-334_1.png

index-334_2.png

index-334_3.png

index-334_4.png

index-334_5.png

index-334_6.jpg

index-334_7.jpg

index-334_8.png

index-334_9.png

index-334_10.png

index-334_11.png

index-334_12.png

index-334_13.png

index-334_14.png

index-334_15.png

index-334_16.png

index-334_17.jpg

index-334_18.png

index-334_19.png

index-334_20.png

The Crazy HelpDesk

and then typed yes! She had then made the macro. WordArt is quite nice, she thought.

Chiara smiled to herself. She knew computer people were only having cybersex, but

for sure she was going to change that. And she liked the idea.

Nico too felt great after this, he smiled, and was just beginning to answer with another macro, when Diagoras came into the scene. And he looked very stern:

“Now stop this you two. Go back to work.”

Dwarfs were really a much too much hard working crowd. Workaholics.

- 334 -

The Crazy HelpDesk

The secret room

At five twenty-nine o’clock exactly Maurice bounced first into Hilde’s office, then into Lut’s just as if he had been waiting to do just this all day along.

He grabbed Hilde by one hand, then Lut by the other.

“Come with me,” he cried out and dragged them along.

“Maurice what’s the matter,” peeped Lut, slightly frightened.

“Come quickly, I have discovered another shortcut.”

How exciting. They split into three again and went to fetch the others.

Maurice was now famous in the CHD for shortcuts. In the labyrinth of the House

shortcuts were as precious to know as to have a blood tie to the HO1 himself.

Shortcuts could spare you hours of time. With the official routes the House offered,

one would take ages to reach his destination. Shortcuts were a solution to get things

done in a reasonable amount of time.

CHD followed Maurice obediently, or most of them, since Johanna wanted to go on

working, but said she would take the HelpDesk calls, and Arthur was nowhere to be

found.

“Where is he?”

“On a seminar in London, with guess whom, Mrko Mrnsk.”

“Oh dear. Will he come back doing everything wrong then?”

“Why doesn’t anyone do anything about this guy?” She meant Mrko Mrnsk..

“It’s worse than that. Hierarchy, if there is one, seems to be playing his game. That’s

what’s wrong.”

Maurice, followed by his troop, left the Curie building, and took the little stone path

which bordered the South rivulet. Until now, nothing unusual.

“How do they not see?”

“And now with all those changes! Mass migration and trillions of new programmes.”

“They don’t want to see the changes.”

“Why not?”

“Because they have neither foreseen nor even planned them.”

“I can’t believe how this came about. With such a major change to come as was this

split of MOU’s, does one not ask from the start: Who are the services involved? Call

them up, gather them, ask them what this sort of change would require in terms of

work to be done?”

“But no one did.”

- 335 -

The Crazy HelpDesk

“Could you have done better?”

“Certainly a bit. But maybe not much. And everyone would have hated me. And don’t

forget: there was an additional factor: Chaos!” Maurice looked proud at that one.

“The question is: WHO decided this split?”

“Yes. QUI? WER? WIE? WHO? HOE? CHI? KDO