Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I created a "textbox" on my worksheet that I fill with data from another
worksheet. The textbox is a "shape". I am able to place text in the box without any problems, however I want a few of the items to be BOLD when I place them. I do not want all the text to be that way. Is there a way to do this within VB? I can select the information with the mouse and press the BOLD button on the commandBar and it does work, so I am guessing there should be a way to do this in VB. I am trying to "paste" the items that came from the worksheet as BOLD. ***some of the code has been removed because it was more than needed.*** Thanks Again. Steve '----------------------------------------------------------------------------- Sub Fill_Letter() Dim ws As Worksheet Dim ws2 As Worksheet Set ws = Worksheets("Billing Letter") Set ws2 = Worksheets("Billing Statement") 'Get Info from Billing Statement Con_Name = ws2.Cells.Range("D12").Value Con_Comp = ws2.Cells.Range("E11").Value Con_Addrs = ws2.Cells.Range("C13").Value Con_City = ws2.Cells.Range("B14").Value 'Place Header on page ws.DrawingObjects("HeaderBox").Select Selection.Characters.Text = "THIRD DISTRICT CHIEF'S ASSOCIATION" 'Place main letter on Page ws.DrawingObjects("Textbox2").Select Sdate = FormatDateTime(Date, vbLongDate) 'Gets Todays Date Selection.Characters.Text = Sdate & Chr(10) & Chr(10) _ & Con_Name & Chr(10) & Con_Comp & Chr(10) _ & Con_Addrs & Chr(10) & Con_City & ", " _ & Con_State & " " & Con_Zip & Chr(10) & Chr(10) _ & "This statement is for services provided by the Hazardous Materials Team" End Sub -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200809/1 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Steve
You can use the Characters method: Sub Test() With Worksheets("Sheet1").Shapes("Text Box 1").TextFrame ..Characters.Text = "sample text" 'the word "text" in bold (need to count characters) ..Characters(8, 4).Font.Bold = True End With End Sub HTH Cordially Pascal "StevenD72 via OfficeKB.com" <u46061@uwe a écrit dans le message de news: 89f90c9668b36@uwe... I created a "textbox" on my worksheet that I fill with data from another worksheet. The textbox is a "shape". I am able to place text in the box without any problems, however I want a few of the items to be BOLD when I place them. I do not want all the text to be that way. Is there a way to do this within VB? I can select the information with the mouse and press the BOLD button on the commandBar and it does work, so I am guessing there should be a way to do this in VB. I am trying to "paste" the items that came from the worksheet as BOLD. ***some of the code has been removed because it was more than needed.*** Thanks Again. Steve '----------------------------------------------------------------------------- Sub Fill_Letter() Dim ws As Worksheet Dim ws2 As Worksheet Set ws = Worksheets("Billing Letter") Set ws2 = Worksheets("Billing Statement") 'Get Info from Billing Statement Con_Name = ws2.Cells.Range("D12").Value Con_Comp = ws2.Cells.Range("E11").Value Con_Addrs = ws2.Cells.Range("C13").Value Con_City = ws2.Cells.Range("B14").Value 'Place Header on page ws.DrawingObjects("HeaderBox").Select Selection.Characters.Text = "THIRD DISTRICT CHIEF'S ASSOCIATION" 'Place main letter on Page ws.DrawingObjects("Textbox2").Select Sdate = FormatDateTime(Date, vbLongDate) 'Gets Todays Date Selection.Characters.Text = Sdate & Chr(10) & Chr(10) _ & Con_Name & Chr(10) & Con_Comp & Chr(10) _ & Con_Addrs & Chr(10) & Con_City & ", " _ & Con_State & " " & Con_Zip & Chr(10) & Chr(10) _ & "This statement is for services provided by the Hazardous Materials Team" End Sub -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200809/1 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Papou,
I think I am missing something. When I use the .characters.Text method, I makes everything in the text box the same size and such. Can you have a look at my code and see what I missed? I am just trying to paste the information in the variable TotalChg if that helps. '----------------------------------------------------------------------------- ----- Sub Fill_Letter() Dim ws As Worksheet Dim ws2 As Worksheet Set ws = Worksheets("Billing Letter") Set ws2 = Worksheets("Billing Statement") 'Get Info from Billing Statement Inc_Date = ws2.Cells.Range("D1").Value Inc_No = ws2.Cells.Range("L1").Value Inc_Addrs = ws2.Cells.Range("C8").Value Con_Name = ws2.Cells.Range("D12").Value Con_Comp = ws2.Cells.Range("E11").Value Con_Addrs = ws2.Cells.Range("C13").Value Con_City = ws2.Cells.Range("B14").Value Con_State = ws2.Cells.Range("H14").Value Con_Zip = ws2.Cells.Range("J14").Value FD = ws2.Cells.Range("D2").Value TotalChg = ws2.Cells.Range("L40").Value 'Place Header on page ws.DrawingObjects("HeaderBox").Select Selection.Characters.Text = "THIRD DISTRICT CHIEF'S ASSOCIATION" & Chr(10) _ & "M.A.B.A.S DIVISION 24" & Chr(10) _ & "HAZARDOUS MATERIALS RESPONSE TEAM" & Chr(10) _ & "BILLING STATEMENT" 'Place main letter on Page ws.DrawingObjects("Textbox2").Select Sdate = FormatDateTime(Date, vbLongDate) 'Gets Todays Date Selection.Characters.Text = Sdate _ & Chr(10) & Chr(10) _ & Con_Name & Chr(10) & Con_Comp & Chr(10) _ & Con_Addrs & Chr(10) & Con_City & ", " _ & Con_State & " " & Con_Zip & Chr(10) & Chr(10) _ & "This statement is for services provided by the MABAS 24 Hazardous Materials " _ & "Response Team for the following incident: " & Inc_No _ & " on " & Inc_Date & " at " & Inc_Addrs & "." _ & Chr(10) & Chr(10) _ & "The Hazardous Materials Team responded at the request of the " & FD _ & " Fire Department. The Team provided technical support. " _ & "These charges are for services provided by the MABAS 24 Hazardous Materials " _ & "Response Team only. Other charges may be pending from municipalities or " _ & "clean-up companies if required." & Chr(10) & Chr(10) _ & "Total charges for services provided by HazMat Response Team: " & TotalChg _ & Chr(10) & Chr(10) _ & "See attached statement of services." _ & Chr(10) & Chr(10) Selection.Characters.Text = Selection.Characters.Text _ & "Please remit to:" & Chr(10) & Chr(10) _ & "Third District Chiefs Association" _ & Chr(10) & "C/O Deb Hoiden" _ & Chr(10) & "Flossmoor Fire Department" _ & Chr(10) & Chr(10) _ & "Any questions, please contact me @ 708-362-0561, or email " _ & Chr(10) & Chr(10) _ & "Sincerely," & Chr(10) & Chr(10) & Chr(10) & Chr(10) _ & "FF/PM Scott Stegenga" & Chr(10) & "Billing Agent" With ws.Shapes("TextBox2").TextFrame .Characters(, Len(TotalChg)).Text = TotalChg .Characters.Font.Bold = True .Characters.Font.Size = 14 .Characters.Font.Name = "Arial" End With End Sub -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200809/1 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Place shape/clipart over radio button | Excel Discussion (Misc queries) | |||
Textbox - Shape | Excel Programming | |||
Chart or Shape Object: A Place To Stash A Few Bytes? | Excel Programming | |||
Converting 'General' formatted cells to Text formatted cell using. | Excel Worksheet Functions | |||
How can I copy formatted text from an Excel textbox into an IE .htm document ? | Excel Programming |