Office SDK samples fail after Office SP2 installed

D

David Ei

I used the video "Office 2003 Video: Building Managed Solutions Behind Word
2003 Documents" and the "Understanding the Word Object Model from a .Net
Developer's Perspective" from the Office SDK 3.0 to write a VB and C# program
that creates a Word document containing a table.

It worked fine until I installed Office Service Pack 2 and Update KB9074517
as recommended on the Office Update site. After this, the CodeBehind program
fails when launched from Visual Studio. No errors are shown, and breakpoints
at the beginning of the program are not hit. There are no errors in the event
logs, either.

I tried setting MS Word's security settings as low as possible, but it
didn't help (no store random number, Macro security = low, Trust all add-ins,
and trust access to VBA Projects).

The code I used is similar to that shown in the video, and worked fine until
I installed the SP. Any ideas?

Private Sub CreateTable()
ThisDocument.Range.Delete()
With ThisDocument.Range
.Font.Name = "Verdana"
.Font.Size = 16
.InsertBefore("Sales by Category")
.InsertParagraphAfter()
.InsertParagraphAfter()
End With
'Dim tableRange As Word.Range =
ThisDocument.Range(ThisDocument.Characters.Count, 0);
Dim tableRange As Word.Range = ThisDocument.Range(0, 0)
ThisDocument.Tables.Add(Range:=tableRange, NumRows:=1, NumColumns:=2)
With ThisDocument.Tables.Item(1)
.Range.Font.Size = 10
.Style = "Table Grid 8"
.ApplyStyleFirstColumn = False
.ApplyStyleLastColumn = False
.ApplyStyleLastRow = False
With .Cell(1, 1).Range
.Text = "Category"
.Font.Bold = True
End With
With .Cell(1, 2).Range
.Text = "Total Quantity"
.Font.Bold = True
End With
End With
End Sub

Private Sub FillTable()
Dim tbl As Word.Table = ThisDocument.Tables(1)
Dim i As Integer = 2
While i < 4
tbl.Rows.Add()
tbl.Cell(i, 1).Range.Text = i.ToString()
tbl.Cell(i, 2).Range.Text = (i + 1).ToString()
i += 1
End While
End Sub
 
C

Cindy M -WordMVP-

Hi David,
I used the video "Office 2003 Video: Building Managed Solutions Behind Word
2003 Documents" and the "Understanding the Word Object Model from a .Net
Developer's Perspective" from the Office SDK 3.0 to write a VB and C# program
that creates a Word document containing a table.

It worked fine until I installed Office Service Pack 2 and Update KB9074517
as recommended on the Office Update site. After this, the CodeBehind program
fails when launched from Visual Studio. No errors are shown, and breakpoints
at the beginning of the program are not hit. There are no errors in the event
logs, either.
Well...

This group isn't really VSTO-oriented. You'd be better off in
vsnet.vstools.office or
http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=16&SiteID=1

where you're more likely to encounter MS folks who will have open ears for any
issues you're experiencing with VSTO.

Also, if the problem is occurring after installing the most recent April Windows
and Office updates, you might try removing them and see if that makes a
difference. Issues have been (and are still being) reported that are causing all
kinds of problems.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top