Var

  • Thread starter T. Alksndr Rstrpo Prado
  • Start date
T

T. Alksndr Rstrpo Prado

hi all,
I'm making a macro which get some data from a text
document.
then put the data in a new word document, then save the
file with the same name as the data.
Here is my problem:
I open the text document, copy and paste the data, but
how I can put the data in the save as name field of the
new file?
The new file has to have the same name as the data.
how can I save in a variable some text I copy from
another document?

Thanks for the help.
The force be with you
 
D

Doug Robbins - Word MVP

Use:

Dim mydata As range, newdoc As Document
Set mydata = Selection.range.FormattedText
Set newdoc = Documents.Add
newdoc.range.FormattedText = mydata
newdoc.SaveAs mydata


--
Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
Doug Robbins - Word MVP
 

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