'Copied range from Excel to Word (Font settings set as hidden?)
I have a code for copying range of data from Excel to Word. Process works but I have just noticed that copied table is not visible in printing mode, in MS Word. After investigations I have found that Font settings are set to "hidden". This should be coming while copy - pasting process. How it can be fixed? I would like to have it visible .Font.Hidden = False
Problem has to be somewhere here rngPara.PasteExcelTable False, False, False?
My code from Excel for copy - paste:
Case "table2"
ThisWorkbook.Sheets("Prices").Range("Q17:V26").Copy
With wdRng
Set rngPara = .Paragraphs.Last.Range
rngPara.Style = wdStyleNormal
rngPara.PasteExcelTable False, False, False
.Tables(.Tables.Count).AutoFitBehavior wdAutoFitWindow
Set rngPara = Nothing
End With
Solution 1:[1]
I solved this problem by adding .Font.Hidden = 0
Case "table2"
ThisWorkbook.Sheets("Prices").Range("Q17:V26").Copy
With wdRng
Set rngPara = .Paragraphs.Last.Range
rngPara.Style = wdStyleNormal
rngPara.PasteExcelTable False, False, False
.Tables(.Tables.Count).AutoFitBehavior wdAutoFitWindow
.Font.Hidden = 0
Set rngPara = Nothing
End With
Solution 2:[2]
Source of the font set to 'hidden' seems to be that Excel Worksheet is set to either xlSheetHidden or xlSheetVeryHidden. Your solution .Font.Hidden = 0 works perfectly.
This fixed my problem with Excel tables copied to Word suddenly missing when exported to PDF.
So thank you, I was losing my mind with this.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | 10101 |
| Solution 2 | Mr Five Thumbs |
