Fill worksheet textbox from vba

Martin1962

New Member
Joined
Mar 17, 2014
Messages
10
Hi,

I have a worksheets called "Sheet1" with multiple embedded textboxes.
in a second worksheet ("Sheet2" I keep my data)

In my code I create 'Public objSheetIn, objShootOut as worksheet'
In the section "Workbook_open" I have this :

DIm shp as Shape

Set objSheetIn = Worksheets("Sheet1")
Set objSheetOut = Worksheets("Sheet2")

I check if the worksheet contains Shapes (If objSheetIn.Shapes.Count > 0 then ...)

Then I run through all shapes :

For Each shp In objSheetIn.Shapes
If Left(shp.Name, 4) = "Txt_" Then

the next instruction goes wrong (assign some text)

objSheetIn.Shapes(shp.Name).TextFrame.Characters.Text = objSheetOut.Cells(1,1)

This retuns error 438 : Object doesn't support this property or method.

Can someone please indicate what's going wrong ?

Kind regards,

Martin
 
Just an update :

replaced
objSheetIn.Txt_date.Activate
by
ActiveSheet.Txt_date.Activate

and it works!

Martin
 
Upvote 0

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Glad you sorted it & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,360
Messages
6,124,492
Members
449,166
Latest member
hokjock

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