Convert wordbasic function to vba for Word XP

N

Nomey

I could use some help with converting this old WordBasic function to a Word XP version (v.10 and up). Can this be done automatically?

Best regards,
Nomey


==========code=========
Private Function fCleanBordersShading()
Dim aShading
Dim aForeground
Dim aBackground
Dim aLine
Dim aColor
Dim aFound
On Error GoTo -1: On Error GoTo eCleanBordersShading
fCleanBordersShading = 0

Dim rFBS As Object: Set rFBS = WordBasic.DialogRecord.FormatBordersAndShading(False)
WordBasic.CurValues.FormatBordersAndShading rFBS

aShading = rFBS.Shading
aForeground = rFBS.Foreground
aBackground = rFBS.Background

aLine = rFBS.LeftBorder
aColor = rFBS.LeftColor

If aShading = 5 And aBackground = 8 And _
(aForeground = 3 Or aForeground = 4 _
Or aForeground = 7 Or aForeground = 16) _
And rFBS.LeftBorder = 1 And rFBS.LeftColor = 16 _
And rFBS.TopBorder = 1 And rFBS.TopColor = 16 _
And rFBS.RightBorder = 1 And rFBS.RightColor = 16 _
And rFBS.BottomBorder = 1 And rFBS.BottomColor = 16 Then
aFound = WordBasic.Call("tw4winMain.fReplace", 1, "^0013", "", 0, 1, 0)
fCleanBordersShading = -1
End If

eCleanBordersShading:
On Error GoTo -1: On Error GoTo 0
End Function
 
C

Cindy M -WordMVP-

Hi Nomey,
I could use some help with converting this old WordBasic function to a Word XP
version (v.10 and up). Can this be done automatically?Well, Word 97 would do a sorta conversion when you opened a file containing
WordBasic - at least the code had a chance of running in the VBA environment. The
results weren't always what you expected...

From a quick look, you'll probably need to do this from scratch, as you can't
"pick up and re-use" current setting en-bloc with VBA, as you could with WordBasic
(the rFBS stuff).

And, in order for us to be of much help, we have to understand what the code is
supposed to accomplish - unfortunately, it doesn't contain any comments as to the
purpose of any of the statements... That If...Then test is rather formidable :)

And we have no idea what tw4winMain.fReplace is supposed to do, so no clues there.

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