1

Good Evening,

I am having trouble with some VBA code. I need the add the Userform's Caption, with text already in place. This is for a application I'm writing which opens a file, and once the file has been opened, it will add the file name to the end of the UserForm's caption. For example:

Program Name: [File Name]

I wouldn't where to start really, which is why I'm here, but I think it might be something like

UserForm1.caption = "Program Name" + file.name

I don't know if this is really possible, but I would greatly appreciate some help

Cheers

2
  • Did you try that? What happened? Commented Dec 21, 2018 at 22:22
  • It's not exact code, and I know that it's wrong because I haven't addressed the right controls in the code. Commented Dec 21, 2018 at 22:27

1 Answer 1

1

Yes it' possible. I think a couple more steps needed

On open of application

logic example / not code:

Pub WriteFileName ()

Range("A:10")
End Sub

For the above, adaptable code example here : How to extract a file name from its path in vba

Then write another macro reading that cell range as string to your UserForm.Caption object i.e ="string" + range.("A10")

Sign up to request clarification or add additional context in comments.

1 Comment

I don't have 15 reputation yet, I'm new. But I will when I reach 15 rep. Thank you again.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.