how to export excel table into word file using vba code | #excel #macro #vba #technology #shorts

preview_player
Показать описание
how to export excel table into word file using vba code

Sub ExportExcelTableinworddocument()

Dim wdapp As New Word.Application

On Error Resume Next

wdapp.Visible = True
wdapp.Activate
wdapp.Documents.Add

With wdapp.Selection

.ParagraphFormat.Alignment = wdAlignParagraphCenter
.BoldRun
.Font.Size = 15
.Font.ColorIndex = wdDarkRed
.TypeText "MIS Report"

End With

Sheet1.Range("A1").CurrentRegion.Copy

wdapp.Selection.Paste
Application.CutCopyMode = False

ActiveDocument.Tables(1).AllowAutoFit = True
ActiveDocument.Tables(1).AutoFitBehavior wdAutoFitContent
ActiveDocument.Close
wdapp.Quit

End Sub
Рекомендации по теме
Комментарии
Автор

Hi, what about sorting the Date from Excel first then exporting the report to Word and then renaming the new Word report to a format of that same date. can you help?

limitone
Автор

GIVING ERROR USER DEFINED TYPE NOT DEFINED
PLZ HELP

rajamuhammadwaseem
visit shbcf.ru