Automatically naming documents after creating them?

I'm looking to make a macro that automatically creates a new document, then names it based on the values from a textbox. It would be called upon submission of the textbox. Ideally, it would name the doc "TB1.Value, TB2.Value, TB3.Value" obviously filling the actual values for all of those? Is there a way to do this? Currently I just use the following-

Dim newDoc As Document

Set newDoc = CreateDocument

not sure if there's a way to add naming to this. Any help would be great! Thanks

Parents Reply
  • This works great! I do not need to save them. Is it possible to have the opt.Name = pull from the textboxes? So if TB1= AA, TB2=BB and TB3=CC, the name would be AA BB CC?

    Sure. In my example, I used the string, "foo". Use any string you like, as long as it's valid to use for a filename. In your case, you can put a string together using the contents of your textboxes.

No Data