20 September 2018

MS Word - Another use for Ctrl+z

Quite a number of articles giving tips and tricks on MS Word advice turning off automatic formatting when users get frustrated and want to stop MS Word from changing certain things that they type, for example, three dashes turning into a horizontal line, or automatically converting to the copyright symbol after typing (c).

There's a simpler solution without the need to go through all the hassle of turning automatic formatting off.

Just undo the typing, or Ctrl+z (the keyboard shortcut).

And next time if you need the horizontal line fast, you can still do it the three dashes way.




15 September 2018

Filler Text for MS Word

Have you come across instances when you need filler text for your MS Word documents, especially when creating templates?

Instead of going to the browser, find a lorem ipsum generator, generate the text, copy, and then going back to MS Word and pasting it, you can do it in just one step. Type "=lorem(p,l)" in your document, where "p" == the number of paragraphs and "l" == the number of lines to generate.

And hit Enter.

Viola! It's like magic.


13 September 2018

MS Excel VBA - Copy hidden Excel worksheet contents to new workbook

Was trying to copy the contents of a hidden worksheet in an Excel to a totally new workbook and edit it via VBA and faced several issues.

     - One can't copy contents from a hidden worksheet. The worksheet must be visible in order for it to be copied.
     - After making it visible, and copying it, there were problems making it hidden again as the current active workbook is the new one instead of the original one.

So the solution is to
   1) Make the hidden worksheet visible
   2) Activate the original workbook
   3) Hide the worksheet
   4) Activate the new workbook with the copied sheet

Below's the code, hopefully can help someone who's facing the same problem out there.

Sub copyHidden()
  'Make hidden sheet visible for copying to new workbook
  Sheets("hiddenSheet").Visible = True
  Sheets("hiddenSheet").Copy

  'activate the original workbook to hide the sheet again
  newbook = Workbooks.Count
  Workbooks.Item(newbook - 1).Activate
  Worksheets("hiddenSheet").Visible = False

  'activate the new workbook with the copied sheet
  Workbooks(newbook).Activate
  ActiveSheet.Name = "copiedSheet"

  'the rest of your code here

End Sub

28 July 2018

一首听似平凡的歌


听似平凡,其实一点也不平凡。

《只要平凡》 (电影《我不是药神》主题曲)
演唱: 张杰/张碧晨



也许很远或是昨天
在这里或在对岸
长路辗转离合悲欢
人聚又人散
放过对错才知答案
活着的勇敢
没有神的光环
你我生而平凡

在心碎中认清遗憾
生命漫长也短暂
跳动心脏长出藤蔓
愿为险而战
跌入灰暗坠入深渊
沾满泥土的脸
没有神的光环
握紧手中的平凡
此心此生无憾
生命的火已点燃

有一天也许会走远
也许还能再相见
无论在人群在天边
让我再看清你的脸
任泪水铺满了双眼
虽无言泪满面
不要神的光环
只要你的平凡

在心碎中认清遗憾
生命漫长也短暂
跳动心脏长出藤蔓
愿为险而战
跌入灰暗坠入深渊
沾满泥土的脸
没有神的光环握
紧手中的平凡

有一天也许会走远
也许还能再相见

无论在人群在天边
让我再看清你的脸

任泪水铺满了双眼
虽无言泪满面

不要神的光环
只要你的平凡
此心此生无憾
生命的火已点燃



19 May 2018

MS Word VBA - Remove Cross Reference Links


Those who use MS Word extensively would likely have come across docs that use the cross-reference link feature.

And sometimes, due to the document passing through many hands, and when it finally comes to you, you find that the cross-reference links are all in a mess, sometimes with Error! messages here and there.

Someone came to find me the other day, and his question was - Could you help me remove the cross-reference links, just the links, but retain the words?

Ok, so I searched the web, and saw a seemingly nifty solution: Ctrl+A, and then Ctrl+Shift+F9

We happily used this, only to find out moments later that the references for all the Figure and Table Captions were all gone as well! This meant that we are no longer able to create a List of Tables/Figures, and that if more tables and figures are to be added, we have to MANUALLY update all the table and figure numbers. Imagine the nightmare with over 100 of them, each. That's a total of more than 200. Gosh.

In desperation, I sought a solution via VBA. After much trial and error, I managed to come up with this. May this help anyone who needs it.

Sub RemoveCrossRefLink()
  Dim objDoc As Document
  Dim objFld As Field
  Dim sFldStr As String
  Dim i As Long, lFldStart As Long

  Set objDoc = ActiveDocument
  ' Loop thru fields in the doc
  For Each objFld In objDoc.Fields
     If objFld.Type = wdFieldRef Then
        objFld.Select
        Selection.Fields.Unlink
        objFld.Update
     End If
  Next objFld
End Sub


3 March 2018

师父 vs 师傅


What's the difference between 师父 and 师傅, other than how it's written?

师父
1) can also mean 师傅
2) a honorific title for monks, nuns, and priests

师傅
1) the teachers who impart their profession skills to others
2) a honorific title for people who are skilled in their profession, eg 厨师傅(chef) 木匠师傅(carpenter)

In olden times, the people/disciples who learn from 师傅s usually start learning when they were very young. The 师傅s' ages thus were around the same as the disciples' fathers. Added to that was the fact that the disciples treated the 师傅s with respect akin to the respect they gave their own fathers, plus usually the 师傅s were male, which often resulted in 师傅 being written as 师父, and people in general accepted this.

Nowadays, though, 师傅s are not necessarily someone as old as the student's father, and might also be a female, so to address a teacher, using 师傅 would be more appropriate.

On the other hand, using 师父 to address a teacher would sound more affectionate, as there is an underlying meaning of 师父=父.

Can one use 师母 instead of 师父 to address a female teacher then?

In this day and age, the term has evolved to include female teachers, though it is more commonly understood that 师母 == 师父's wife.


18 February 2018

Zombie Fans

"Zombie fans" is one of those terms which has multiple meanings.

It can mean
1) People who love all things related to zombies
2) People who are fans of "The Walking Dead"
3) Fake followers on social media

The third is a straight translation from the Chinese term "僵尸粉", a term that originated from the internet, as one can see from what it means.

It is said that people even used zombie fans to "earn money" - they created fake accounts and followed a particular person, and after some time, starts to decrease that person's number of followers, and then sends a private message to that person to "ask" for payment so as to maintain the number of followers.

When it comes to money, people are indeed creative.


27 January 2018

The Happy Birthday Song


Everyone knows how to sing the birthday song - "Happy birthday to you~" repeat 4 times. One variation would include changing the 3rd time to "Happy birthday to [insert name]".

In my school days, another variation went:
"Happy birthday to you,
You were born in the zoo,
With monkeys and elephants,
Happy birthday to you."

Sounds ok yeah? Not too offensive yeah?

So the other day I got to know of another version straight from the Nephew's mouth. It started the same, "Happy birthday to you". And the next line went - "You were born in the sky". I was like, wow, born in the sky? That's... nice? Sky ma, we love the sky, don't we?... though it doesn't rhyme with "you"...

The 3rd line surprisingly rhymed with "sky", but when I heard it I was quite horrified: "You will drop down and die~" .................................... and ended with "Happy birthday to you."

... Speechless.