Textbox ControlSource property problems...

L

Legacy 98055

Guest
Hi all.

I cannot figure out the syntax and keep getting:

ControlSourceError.gif


This is the syntax I am using to set the controlsource property of a textbox on a userform.

TextBox1.ControlSource = "[MyWorkBook.xls]Sheet1!A1"

Where "MyWorkBook.xls" is a workbook that is currently open.

My goal, if possible, is to use a range on "MyWorkBook.xls" as the controlsource for my textbox on my userform that resides in a separate workbook.

Thanks for any help.
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Disregard. The actual name of my workbook that contain the sheet and range I wished to use as my controlsource for my textbox was "DDE Example WB.xls". Since there are spaces contained within the workbook's name, it is neccesary to wrap the workbook/sheet string in apostrophes.

Correct:
'[DDE Example WB.xls]Sheet1'!A1

Incorrect:
[DDE Example WB.xls]Sheet1!A1

It figures I would spend about 40 minutes and then figure it out as soon as I posted. :)

Oh well.... Problem solved!

Goodnight!
 
Upvote 0

Forum statistics

Threads
1,214,807
Messages
6,121,679
Members
449,047
Latest member
notmrdurden

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top