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

Josh F
  • 37
  • 11

1 Answers1

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")

melp
  • 64
  • 4