Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Saving text for later use in word

Status
Not open for further replies.

kalle82

Technical User
Apr 2, 2009
163
0
0
SE
Hi!

I am working i VBA word.

I have created a userform that does many things but now I'm about to start work on the last one.

1. I want users to be able to paste text into a rich texteditor so that bold font and stuff like that don't get lost.
question: Is there a richtext control?

2. Then I want them to be able to save the text under a name for later use.
question: should i store them as variables in the program, or in a separate textfile? And how any tips?

3. When they open the program the saved texts get loaded, the click on one and it gets written in a word doucment.
question: how do i load the text, do i use some kind of loop function?

Hope you can clarify this or point me to something that already does this.

regards

Carl
 
1. yes and no. There are third party versions. have you Google'd this?

2. it depends. How many? If one or two, I would use Variables. More? An .ini file perhaps.

3.
"When they open the program
- what program? Do you mean document?

"the saved texts get loaded,

Ummm...loaded where?

it gets written in a word doucment

WHAT document?

question: how do i load the text

Again, it depends. If you are opening a document with the Variables previously given values, it is simple. Use the Variable.
Code:
ActiveDocument.Variables("Name").Value

If you have them in an INI file, you have to open the ini file first and get the values you want.


Or, if they are in a text file, you have to open that.

Or, if you have them in an Excel file (who knows?), you have to open that.

Gerry
 
Sorry for my unclear description.

Im working within the word application.

Im about to build a function where the users can paste a text they written, into a textbox in my userform. (heres the rich texteditor). On our workstations im npt able to isntall anything they restricted installations to admins :(

When they pasted the text, they should be able to save it for later use. As for the answer i think ill go with an .ini file.

How do i save the pasted text towards an .ini?

And how do loop the ini file so they can choose between their texts?
 
I think you better start with coding and using the basics. You have some concepts twisted around.

"how do loop the ini file so they can choose between their texts? "

1. they don't. There is no looping.
2. if they want to choose between what was written to ini file...YOU have pull them out. Do you know what an INI file looks like?

"How do i save the pasted text towards an .ini?"

You don't. You write to one.

Did you read what I wrote about rich-text controls?

"Im about to build a function where the users can paste a text they written"

Do you know what a function is?

Gerry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top