filmov
tv
Excel VBA Macro: Create Word Document & Add Table (Static Range)

Показать описание
Excel VBA Macro: Create Word Document & Add Table (Static Range). In this video, we go over how to add a table with a set range to a word document using excel. We also enable borders in the table and change the background color of the table with our code.
Code:
Sub add_table_2_word()
Dim objWord
Dim objDoc
Dim objSelection
Dim i As Integer
Dim j As Integer
Set objWord = CreateObject("Word.Application")
Set objDoc = objWord.Documents.Add
Set objSelection = objWord.Selection
objWord.Visible = True
objWord.Activate
Set CountryTable = objDoc.Tables.Add(objSelection.Range, 6, 3)
With CountryTable
With .Borders
.enable = True
.outsidecolor = RGB(0, 0, 0)
.insidecolor = RGB(0, 0, 0)
End With
For i = 1 To 6
For j = 1 To 3
.cell(i, j).Range.InsertAfter ThisWorkbook.Sheets("Sheet1").Cells(i, j).Text
Next j
Next i
End With
End Sub
#ExcelVBA #ExcelMacro
Code:
Sub add_table_2_word()
Dim objWord
Dim objDoc
Dim objSelection
Dim i As Integer
Dim j As Integer
Set objWord = CreateObject("Word.Application")
Set objDoc = objWord.Documents.Add
Set objSelection = objWord.Selection
objWord.Visible = True
objWord.Activate
Set CountryTable = objDoc.Tables.Add(objSelection.Range, 6, 3)
With CountryTable
With .Borders
.enable = True
.outsidecolor = RGB(0, 0, 0)
.insidecolor = RGB(0, 0, 0)
End With
For i = 1 To 6
For j = 1 To 3
.cell(i, j).Range.InsertAfter ThisWorkbook.Sheets("Sheet1").Cells(i, j).Text
Next j
Next i
End With
End Sub
#ExcelVBA #ExcelMacro
Excel VBA Macro: Create Word Document (and Write with Excel)
(1/2) Automating Word Documents from Excel - No VBA
Excel VBA Macro: Create Word Document & Add Table (Static Range)
How to Create Macros in Excel Tutorial
Push Data from Excel to MS Word Content Controls using Excel VBA
Automate Word Document from Excel Using VBA
Excel VBA Macros: Data Entry Made Easy with These Tips and Tricks
Excel VBA - Write a Simple Macro
Free Excel VBA Course #35 - Creating Word Reports Using VBA
Excel to Word VBA Macro Programe
Excel VBA Macro: Create Word Document (Template File) Based on Cell Values
Excel Macros & VBA - Tutorial for Beginners
Real-life Word App Automation Using VBA. Read/write to Word Document, Publish, Print and more
Create VBA Macro for Multiple Files - Lesson 8 - Run the macro from any word file
Excel VBA Macro: Create Word Document & Copy Paste Chart/Graph/Diagram (from Excel)
Learn Excel VBA to Automate Anything
MS Word text convert to excel short trick 🔥😲 #viral #excel #shortvideo #exceltips #computer
VBA Automation for Excel 2019 Cookbook | 17. Creating Word Documents with Excel VBA
Create a word document using bookmarks, through VBA with Excel
Creating your first Button with Excel VBA
How to Create & Use Excel Macros (Real world example)
Excel VBA Introduction Part 27.1 - Creating Word Documents
Excel to Word: Excel To Word Using VBA - Episode 2284
Create and Add Text to Word Document with Excel VBA
Комментарии