Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Word Control in Excel
Using Office 2000, I open Word and in a new document
I insert a Textbox. I then copy and paste it into a worksheet. I cannot find a way to programmatically refer to it. Sub Test() Dim oleObj As OLEObject, rng As Range For Each oleObj In ActiveWorkbook.Sheets _ ("Contract Master Order").OLEObjects If TypeOf oleObj.Object Is MSForms.TextBox Then Set rng = oleObj.TopLeftCell rng.Value = "Bingo" End If Next End Sub The 'If' statement gives the error: User defined type not defined How do I control the Textbox, please? --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.716 / Virus Database: 472 - Release Date: 05/07/2004 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Word Control in Excel
Try adding a reference to "microsoft forms 2.0 object library"
I'm not sure how this'll work with your Word problem, though. Stuart wrote: Using Office 2000, I open Word and in a new document I insert a Textbox. I then copy and paste it into a worksheet. I cannot find a way to programmatically refer to it. Sub Test() Dim oleObj As OLEObject, rng As Range For Each oleObj In ActiveWorkbook.Sheets _ ("Contract Master Order").OLEObjects If TypeOf oleObj.Object Is MSForms.TextBox Then Set rng = oleObj.TopLeftCell rng.Value = "Bingo" End If Next End Sub The 'If' statement gives the error: User defined type not defined How do I control the Textbox, please? --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.716 / Virus Database: 472 - Release Date: 05/07/2004 -- Dave Peterson |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Word Control in Excel
Thanks for that.
It now runs to the line "For Each etc" and then immediately jumps to "End Sub" Regards. "Dave Peterson" wrote in message ... Try adding a reference to "microsoft forms 2.0 object library" I'm not sure how this'll work with your Word problem, though. Stuart wrote: Using Office 2000, I open Word and in a new document I insert a Textbox. I then copy and paste it into a worksheet. I cannot find a way to programmatically refer to it. Sub Test() Dim oleObj As OLEObject, rng As Range For Each oleObj In ActiveWorkbook.Sheets _ ("Contract Master Order").OLEObjects If TypeOf oleObj.Object Is MSForms.TextBox Then Set rng = oleObj.TopLeftCell rng.Value = "Bingo" End If Next End Sub The 'If' statement gives the error: User defined type not defined How do I control the Textbox, please? --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.716 / Virus Database: 472 - Release Date: 05/07/2004 -- Dave Peterson --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.716 / Virus Database: 472 - Release Date: 05/07/2004 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Word Control in Excel
Hi Stuart,
Try: Sub Test() Dim myShape As Shape, rng As Range For Each myShape In ActiveWorkbook.Sheets _ ' ("Contract Master Order").Shapes If myShape.Name Like "Text*" Then Set rng = myShape.TopLeftCell rng.Value = "Bingo" End If Next End Sub --- Regards, Norman "Stuart" wrote in message ... Thanks for that. It now runs to the line "For Each etc" and then immediately jumps to "End Sub" Regards. "Dave Peterson" wrote in message ... Try adding a reference to "microsoft forms 2.0 object library" I'm not sure how this'll work with your Word problem, though. Stuart wrote: Using Office 2000, I open Word and in a new document I insert a Textbox. I then copy and paste it into a worksheet. I cannot find a way to programmatically refer to it. Sub Test() Dim oleObj As OLEObject, rng As Range For Each oleObj In ActiveWorkbook.Sheets _ ("Contract Master Order").OLEObjects If TypeOf oleObj.Object Is MSForms.TextBox Then Set rng = oleObj.TopLeftCell rng.Value = "Bingo" End If Next End Sub The 'If' statement gives the error: User defined type not defined How do I control the Textbox, please? --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.716 / Virus Database: 472 - Release Date: 05/07/2004 -- Dave Peterson --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.716 / Virus Database: 472 - Release Date: 05/07/2004 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Word Control in Excel
Hi Stuart,
Please uncomment the continuation part of the For Each line! --- Regards, Norman "Norman Jones" wrote in message ... Hi Stuart, Try: Sub Test() Dim myShape As Shape, rng As Range For Each myShape In ActiveWorkbook.Sheets _ ' ("Contract Master Order").Shapes If myShape.Name Like "Text*" Then Set rng = myShape.TopLeftCell rng.Value = "Bingo" End If Next End Sub --- Regards, Norman "Stuart" wrote in message ... Thanks for that. It now runs to the line "For Each etc" and then immediately jumps to "End Sub" Regards. "Dave Peterson" wrote in message ... Try adding a reference to "microsoft forms 2.0 object library" I'm not sure how this'll work with your Word problem, though. Stuart wrote: Using Office 2000, I open Word and in a new document I insert a Textbox. I then copy and paste it into a worksheet. I cannot find a way to programmatically refer to it. Sub Test() Dim oleObj As OLEObject, rng As Range For Each oleObj In ActiveWorkbook.Sheets _ ("Contract Master Order").OLEObjects If TypeOf oleObj.Object Is MSForms.TextBox Then Set rng = oleObj.TopLeftCell rng.Value = "Bingo" End If Next End Sub The 'If' statement gives the error: User defined type not defined How do I control the Textbox, please? --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.716 / Virus Database: 472 - Release Date: 05/07/2004 -- Dave Peterson --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.716 / Virus Database: 472 - Release Date: 05/07/2004 |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Word Control in Excel
Thanks for that.
It steps through without an error, but no values appear in the textboxes. Any ideas, please? Regards. "Norman Jones" wrote in message ... Hi Stuart, Please uncomment the continuation part of the For Each line! --- Regards, Norman "Norman Jones" wrote in message ... Hi Stuart, Try: Sub Test() Dim myShape As Shape, rng As Range For Each myShape In ActiveWorkbook.Sheets _ ' ("Contract Master Order").Shapes If myShape.Name Like "Text*" Then Set rng = myShape.TopLeftCell rng.Value = "Bingo" End If Next End Sub --- Regards, Norman "Stuart" wrote in message ... Thanks for that. It now runs to the line "For Each etc" and then immediately jumps to "End Sub" Regards. "Dave Peterson" wrote in message ... Try adding a reference to "microsoft forms 2.0 object library" I'm not sure how this'll work with your Word problem, though. Stuart wrote: Using Office 2000, I open Word and in a new document I insert a Textbox. I then copy and paste it into a worksheet. I cannot find a way to programmatically refer to it. Sub Test() Dim oleObj As OLEObject, rng As Range For Each oleObj In ActiveWorkbook.Sheets _ ("Contract Master Order").OLEObjects If TypeOf oleObj.Object Is MSForms.TextBox Then Set rng = oleObj.TopLeftCell rng.Value = "Bingo" End If Next End Sub The 'If' statement gives the error: User defined type not defined How do I control the Textbox, please? --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.716 / Virus Database: 472 - Release Date: 05/07/2004 -- Dave Peterson --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.716 / Virus Database: 472 - Release Date: 05/07/2004 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.716 / Virus Database: 472 - Release Date: 05/07/2004 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel spin box - no Control tab in Format Control dialong box | Excel Worksheet Functions | |||
Word wrapping in Text Box Control feature | Excel Worksheet Functions | |||
how to control word from excel | Excel Programming | |||
Print Control in Word/Excel | Excel Programming | |||
Print Control in Word/Excel | Excel Programming |