Need Excel code to work in Word

D

djl0525

I found this spreadsheet by John Walkenbach (Excel Guru) that has code
I'd like to use in Word.

http://spreadsheetpage.com/index.php/tip/mail_merge_without_word

1. John's Excel file has a help button that displays a userform.
2. The userform displays directions to guide the user on how to do
something in Excel.
3. The directions (text) in the userform is stored in one of the
sheets in the workbook.

Those are the elements I care about. A userform with text that is
editable.

The procedure in John's Excel file talks you through doing a mail
merge in Excel without using Microsoft word, but I don't care about
that. What I want is a userform in Word that displays text (stored in
Word) that I can easily edit. If the help text needs to be in a
separate Word document, that's fine.

1. A help button is easy.
2. A userform is easy.
3. Where to store the editable text and how to get it in the userform
- that's the challenge!!

If anyone is interested in taking on this challenge, please contact
me. Thank you in advance for your consideration.

--DJ
 
D

Doug Robbins - Word MVP

Use the code similar to the following in the initialize event of the
userform

Dim source As Document
Dim strFormText As String
Set source = Documents.Open("C:\test\formtext.doc")
strFormText = source.Range.Text
TextBox1.Text = strFormText
source.Close wdDoNotSaveChanges
Set source = Nothing

You will need to set the Multiline attribute of TextBox1 to True and
probably the ScrollBars attribute to 2 - fmScrollBarsVertical

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
 

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