Being able to bold and indent .selection.typetext in VBA

ShaunBurke3

New Member
Joined
Dec 9, 2023
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hello, I've created a macro that generates a word document. There are certain lines in the code that I want bolded and indented in the word document when it is generated. I cannot find the VBA code to do that. Any thoughts? I have added a screenshot of the basic structure of what the word document would look like

VBA Code:
Dim objDoc

Set objWord = CreateObject("Word.Application")
Set objDoc = objWord.Documents.Add

With objWord

.Visible = True
.Activate
.Selection.TypeText ("Good morning, Everyone!")
.Selection.TypeParagraph
.Selection.TypeText ("[Enter Narrative Here]")
.Selection.TypeParagraph
.Selection.TypeText ("Here is the status of the queues for ")
    .Selection.TypeText (ThisWorkbook.Sheets("Report").Cells(4, 2).Text)

.Selection.TypeParagraph
.Selection.TypeParagraph

.Selection.TypeText ("We have a total of ")
    .Selection.TypeText (ThisWorkbook.Sheets("Report").Cells(5, 2).Text)
.Selection.TypeText (" in queues.")
.Selection.TypeText (" There are ")
    .Selection.TypeText (ThisWorkbook.Sheets("Report").Cells(6, 2).Text)
.Selection.TypeText (" new tickets, ")
    .Selection.TypeText (ThisWorkbook.Sheets("Report").Cells(7, 2).Text)
.Selection.TypeText (" Assigned Tickets, ")
    .Selection.TypeText (ThisWorkbook.Sheets("Report").Cells(8, 2).Text)
.Selection.TypeText (" SMS tickets, and ")
    .Selection.TypeText (ThisWorkbook.Sheets("Report").Cells(9, 2).Text)
.Selection.TypeText (" Open Message tickets.")
.Selection.TypeParagraph
.Selection.TypeText ("The number of AAG tickets is ")
    .Selection.TypeText (ThisWorkbook.Sheets("Report").Cells(10, 2).Text)
.Selection.TypeParagraph
.Selection.TypeText ("[Enter Narrative Here]")
.Selection.TypeParagraph
.Selection.TypeText ("There are ")
    .Selection.TypeText (ThisWorkbook.Sheets("Report").Cells(11, 2).Text)
.Selection.TypeText (" unassigned text tickets.")
.Selection.TypeParagraph
.Selection.TypeText ("[Enter Narrative Here]")
.Selection.TypeParagraph
.Selection.TypeText ("There are ")
    .Selection.TypeText (ThisWorkbook.Sheets("Report").Cells(12, 2).Text)
.Selection.TypeText (" open messaging tickets in the queue")
.Selection.TypeParagraph
.Selection.TypeText ("[Enter Narrative Here]")

.Selection.TypeParagraph
.Selection.TypeParagraph
.Selection.TypeText ("4 Hour Queue:")
    .Selection.TypeText (ThisWorkbook.Sheets("Report").Cells(13, 2).Text)
.Selection.TypeText (" total tickets")
.Selection.TypeText ("1 Business day:")
    .Selection.TypeText (ThisWorkbook.Sheets("Report").Cells(14, 2).Text)
.Selection.TypeText (" total tickets")
.Selection.TypeParagraph
.Selection.TypeText ("[Enter Narrative Here]")

.Selection.TypeParagraph
.Selection.TypeParagraph
.Selection.TypeText ("The goal for today is [Enter Narrative Here]")
.Selection.TypeParagraph
.Selection.TypeParagraph

.Selection.TypeText ("Phone volume is 'x' for the day - coming in at ")
    .Selection.TypeText (ThisWorkbook.Sheets("Report").Cells(15, 2).Text)
.Selection.TypeText ("/per hour")
.Selection.TypeParagraph
.Selection.TypeText ("[Enter Narrative Here about incoming volume]")
.Selection.TypeParagraph
.Selection.TypeText ("Current average wait time is ")
    .Selection.TypeText (ThisWorkbook.Sheets("Report").Cells(16, 2).Text)
.Selection.TypeText (" seconds.")
.Selection.TypeParagraph
.Selection.TypeText ("[Enter Narrative Here about thin spots for the day]")

.Selection.TypeParagraph
.Selection.TypeParagraph
.Selection.TypeText ("Email volume is 'x' for the day - coming in at ")
    .Selection.TypeText (ThisWorkbook.Sheets("Report").Cells(17, 2).Text)
.Selection.TypeText ("/per hour incoming, ")
    .Selection.TypeText (ThisWorkbook.Sheets("Report").Cells(18, 2).Text)
.Selection.TypeText (" solve ")
.Selection.TypeParagraph
.Selection.TypeText ("[Enter Narrative Here about solves]")
.Selection.TypeParagraph
.Selection.TypeText ("[Enter Narrative Here about progress during the morning]")
.Selection.TypeParagraph
.Selection.TypeText ("[Enter Narrative Here about Assembled projectiosn about backlog]")


.Selection.TypeParagraph
.Selection.TypeParagraph
.Selection.TypeText ("Messaging is seeing 'x' volume")

.Selection.TypeParagraph
    .Selection.TypeText (ThisWorkbook.Sheets("Report").Cells(19, 2).Text)
.Selection.TypeText (" solved messaging tickets, ")
   .Selection.TypeText (ThisWorkbook.Sheets("Report").Cells(20, 2).Text)
.Selection.TypeText (" chats rated good,  ")
   .Selection.TypeText (ThisWorkbook.Sheets("Report").Cells(21, 2).Text)
.Selection.TypeText (" chats rated bad")
.Selection.TypeParagraph
   .Selection.TypeText (ThisWorkbook.Sheets("Report").Cells(22, 2).Text)
.Selection.TypeParagraph
.Selection.TypeText ("[Narrative about messaging]")

.Selection.TypeParagraph
.Selection.TypeParagraph
.Selection.TypeText ("[Narrative about scheduling update]")
.Selection.TypeParagraph
.Selection.TypeText ("Returns to flip: ")
   .Selection.TypeText (ThisWorkbook.Sheets("Report").Cells(23, 2).Text)
.Selection.TypeText ("total")
.Selection.TypeText ("OMS / Orderhub Updates")
.Selection.TypeParagraph
.Selection.TypeText ("[Enter Narrative Here]")
.Selection.TypeParagraph
.Selection.TypeText ("Individuals out for th eday:")
   .Selection.TypeText (ThisWorkbook.Sheets("Report").Cells(24, 2).Text)
.Selection.TypeParagraph
.Selection.TypeText ("[Enter narrative about reassigning queues]")

.Selection.TypeParagraph
.Selection.TypeParagraph
.Selection.TypeText ("Everyone have a great day!")

End With

End Sub
A
 

Attachments

  • DTR Daily.jpg
    DTR Daily.jpg
    100.4 KB · Views: 14

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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