Avatar of rutgermons
rutgermons
 asked on

vb macro strFileName based in field in excel sheet

folks

how can i make my output file name exported from excel (using a macro) be named after a field in the excel sheet itself?

i.e. the value from B1 from sheet 1


strDefFolder = Trim(InputBox(" Enter path to save file", "File Location", ""))
system = field B1

strFileName = system & Day

All help will do
VB ScriptMicrosoft Excel

Avatar of undefined
Last Comment
rutgermons

8/22/2022 - Mon
Qlemo

You can use e.g. System = [B1].Value or System = Range("B1").Value if you are in Sheet1, or System = [Sheet1!B1].Value if in another sheet. Even better, name your field, and use that name instead of B1.
ASKER CERTIFIED SOLUTION
CvD

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
rutgermons

ASKER
Thanks CvD, your comment was the most complete solution and worked for me!

cheers
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck