Tuesday, 22 September 2009

Update all fields in Word, including headers and footers (Edit)

At 11th November last year, I post a piece of code to update all fields in a Word document. Some people respond that it didn't work. Well, I tried, and it seems that's true.
Today, I rewrote a new piece of code I found, and that seems to work fine. I created an extension method for the Word.Document object that does the trick.


_
Sub UpdateAllFiels(ByVal doc As Word.Document)

Dim section As Word.Section
Dim myRange As Word.Range
Dim myHF As Word.HeaderFooter

doc.Fields.Update()

For Each section In doc.Sections

For Each myHF In section.Headers
myRange = myHF.Range

For Each aField In myRange.Fields
If aField.Type = Word.WdFieldType.wdFieldDocProperty Then
aField.Update()
End If
Next aField

Next myHF

For Each myHF In section.Footers
myRange = myHF.Range

For Each aField In myRange.Fields
If aField.Type = Word.WdFieldType.wdFieldDocProperty Then
aField.Update()
End If
Next aField

Next myHF

Next section

End Sub

So, now I am able to update all fields easily in my document. In my Word Add-on, I created a own ribbon tab, I placed a button on it, which does the following:

Globals.ThisAddIn.Application.ActiveDocument.UpdateAllFiels()

Note: Extension methods is supported on .NET framework 3.5 or higher

Edit: A little fix: 'doc.Fields.Update()' added to the code. This is the regular Word Update All Fields function (so without doing Headers and Footers).

Read more...

Monday, 14 September 2009

Windows 7 and Blue Screen

Yep, it's still there. Today, I successfully installed Windows 7. No installation errors, normal function of existing application. So far so good.
O, than I got noticed to install at least one 'critical' update. Well, o.k. then, I choose also three other, less important updates.
Than the installation started, and yes!!! the blue screen of death appeared. So, it's still there, and the problem event has got a name: the BlueScreen event

Read more...

Wednesday, 9 September 2009

Do you need to click or to cut a button?

Sorry, but for this post you need to know the Dutch language (a bit)

I installed a Dutch version of Windows 7 Ultimate edition on a virtual pc. Just to see how it looks like. I found a small application to capture a part of the screen and I started it (in Dutch called 'Knipprogramma'). From that moment, I got confused, do I really have to 'cut' the new button?



For non Dutch speakers, its the last part of the sentence: "Knip op de knop Nieuw" which sounds in English as "Cut on the button New".

Read more...

Tuesday, 1 September 2009

Your client does not support opening the list with Windows Explorer

In some cases people deals with the problem opening a SharePoint list in the Windows Explorer view. The problem that caused the message “Your client does not support opening the list with Windows Explorer”, can be solved with this:
  1. Download the Windows update 907306 and install this one (http://support.microsoft.com/kb/907306)
    By the way, you need to apply this on the client machine, because it is a local pc security issue

Normally this would be enough. If not, you need to perform the following steps (on the client machine):

  1. Start file explorer and go to Network Places
  2. Add a network place:

    A wizard is started with which you can add a network location:

  3. Type in the url of you SharePoint site
  4. The SharePoint site is now added a a network location and the problem should be solved by now.

Read more...

  © Blogger templates Psi by Ourblogtemplates.com 2008

Back to TOP