MS WORD MACRO PUZZLER

Subject: MS WORD MACRO PUZZLER
From: "D. Philipp Binggeli" <DBinggeli -at- ALLENCOMM -dot- COM>
Date: Thu, 13 Jul 1995 08:22:00 PDT

Greetings:

Anyone ever dabbled with MS Word 6.0 macros using WordBasic?

Last time I had a macro question, I received some great input from some
techwhirlers, but back then I was with a different company...and of course,
I did not take my old e-mail messages with me when I changed jobs. Which
means, that I cannot contact the geniuses directly.

_____________________________________________________________________
THE PROBLEM: I am writing a macro in which I prompt the user to enter some
information that later will be inserted in a specific place in the current
document. So far so good. However, in order to maintain the document's
formatting, the user can only enter up to 155 characters (so the table will
keep its length, and the document will not get longer than one page, and
everything else in the document will remain "lined up and orderly").

OK, so I check for the length of the text the user entered in the custom
dialog box, and if it's more than 155 characters, a message will appear, and
the custom dialog box will appear again. HERE'S THE SNAG: The custom dialog
box appears in its default state--that means, anything and everything the
user entered will be lost.

Any ideas how I can make it so that the user's values (checkboxes selected
and text entered) will still be there when the dialog box comes back the
second time?

I should add that I am working with the Windows version this time. On the
Mac, I could simply use the DlgLoadValues and the DlgStoreValues statements
to solve this problem. In Windows, this option is not available. Any ideas?
Anyone? Below is a copy of the macro text...if that helps.

Thanks for any ideas anyone might have,

Dee Philipp
dbinggeli -at- allencomm -dot- com

===========================MACRO TEXT================================
Sub MAIN

On Error Resume Next

ToolsUnprotectDocument .DocumentPassword = "papa"

WiederHolen: 'we get here when there are more than 155 characters
'in the text box

REM x (from left),y (from top),w,h

Begin Dialog UserDialog 550, 174, "Installation..."
TextBox 20, 97, 376, 58, .Comment$, 1
OKButton 455, 149, 88, 21
CancelButton 455, 123, 88, 21
Text 20, 17, 496, 13, "Is there any kind of information available as
far as the installation", .Text1
Text 20, 32, 216, 13, "of this course is concerned?", .Text2
Text 20, 77, 83, 13, "Comments:", .Text3
OptionGroup .YesOrNo
OptionButton 20, 51, 57, 16, "Yes", .OptionButton1
OptionButton 180, 51, 51, 16, "No", .OptionButton2
End Dialog
Dim InstallationDlg As UserDialog


If Dialog(InstallationDlg) Then
If InstallationDlg.YesOrNo = 0 Then
EditBookmark .Name = "Installation", .SortBy = 0, .Goto
NextCell
Insert "YES"
Else
EditBookmark .Name = "Installation", .SortBy = 0, .Goto
NextCell
Insert "NO"
End If
End If


If Len(InstallationDlg.Comment$) > 155 Then
MsgBox "Please edit your comments for length. You have more than the
permissible 155 characters."
Goto WiederHolen 'goes back to reentry point before dialog box
End If


EditBookmark .Name = "Installation", .SortBy = 0, .Goto
NextCell
NextCell
Insert InstallationDlg.Comment$


ToolsProtectDocument .DocumentPassword = "papa", .NoReset = 0, .Type = 2

End Sub
===============================E N D==================================


Previous by Author: DOS screen capture program...?
Next by Author: All about DOS screen captures!
Previous by Thread: Job opening--Montreal, Quebec, Canada
Next by Thread: Re: MS WORD MACRO PUZZLER


What this post helpful? Share it with friends and colleagues:


Sponsored Ads