MS Excel VBA to use a form field selection as a name

Experts.

I created a drop down screen so users may select a workbook and after selection, the path and the name appear in the box named: SSReportBuilder.xls.UserForm1.SSFileName

While running the code (another button on the form named UserForm1) a message appears stating “Object Required”.  

The code it highlights is: FullName = SSReportBuilder.xls.UserForm1.SSFileName.

Since there is a need for this form to be open, I have not been able to test it inside VBA.

Please advise as to how the test may be performed or suggest an alternate way to assign a name to the selected “Full Path Excel file”

Thanks,
LVL 1
CFMIFinancial Systems AnalystAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jeffrey CoachmanMIS LiasonCommented:
If "FullName" is supposed to store the fullname of the file, then it should be something like this:
d:\SomeFolder\Somefile.xls
(The full drive, path, filename, and extension of the file)

I am not sure how : SSReportBuilder.xls.UserForm1.SSFileName.
...can translate into a full file name...

ad a message box after the line:
FullName = SSReportBuilder.xls.UserForm1.SSFileName.
msgbox FullName
...and see what is returned


JeffCoachman
0
CFMIFinancial Systems AnalystAuthor Commented:
I added the message box but while running I receive an error message, :Object Required".   below displays the two statements and I attached the spreadsheet form.

FullName = SSReportBuilder.xls.UserForm1.SSFileName
MsgBox FullName
SpreadsheetForm.jpg
0
Martin LissOlder than dirtCommented:
Can you attach your workbook?
0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

CFMIFinancial Systems AnalystAuthor Commented:
Please see attached workbook.
SSReportBuilder.xls
0
Martin LissOlder than dirtCommented:
Change

FullName = SSReportBuilder.xls.UserForm1.SSFileName

to

FullName = UserForm1.SSFileName

What was confusing us was that FullName is an Application property (Application.FullName). You should change your variable's name to avoid confusion.
0
Martin LissOlder than dirtCommented:
You should also change

Set wbTarget = app.Workbooks.Open(SSFileName)

to

Set wbTarget = app.Workbooks.Open(FullName)

or

Set wbTarget = app.Workbooks.Open(UserForm1.SSFileName)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
CFMIFinancial Systems AnalystAuthor Commented:
Excellent, the VBA code worked well.
0
Martin LissOlder than dirtCommented:
You're welcome and I'm glad I was able to help.

Marty - MVP 2009 to 2013
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.