hello everyone,
I want to save the QM code as a word file
The following code, can achieve this goal,
Operation steps:
1. Open the QM code[Eg, test] to be saved, press Ctrl + A to select all, and then press the right mouse button to select Other Formats-->Copy HTML--->With Tabs and Spaces
2. run Macro9 , The created word file will be opened automatically
but there are a few places, not very convenient
1.
How to automate the first step above? Call a function to implement it?
2.
In word file, I need to delete the underline of tab stop, The method I use is to Set the color of the underline to white
Code Line13-16
but it has no effect, The result is HTML code
3.
In word file, I need to set the width of the tab stop,
Code Line8
but it has no effect
4.
In word file, Set the font Courier New for all characters
Code Line9-11
but it has no effect
Is there a better solution? Any suggestions are welcome. Thanks in advance
![[Image: pic.png]](https://i.ibb.co/BLpvVch/pic.png)
Macro Macro9
Macro test
I want to save the QM code as a word file
The following code, can achieve this goal,
Operation steps:
1. Open the QM code[Eg, test] to be saved, press Ctrl + A to select all, and then press the right mouse button to select Other Formats-->Copy HTML--->With Tabs and Spaces
2. run Macro9 , The created word file will be opened automatically
but there are a few places, not very convenient
1.
How to automate the first step above? Call a function to implement it?
2.
In word file, I need to delete the underline of tab stop, The method I use is to Set the color of the underline to white
Code Line13-16
but it has no effect, The result is HTML code
3.
In word file, I need to set the width of the tab stop,
Code Line8
but it has no effect
4.
In word file, Set the font Courier New for all characters
Code Line9-11
but it has no effect
Is there a better solution? Any suggestions are welcome. Thanks in advance
![[Image: pic.png]](https://i.ibb.co/BLpvVch/pic.png)
Macro Macro9
typelib Word {00020905-0000-0000-C000-000000000046} 8.0
Word.Application app._create
str WordDoc="$desktop$\\test.docx"
VARIANT vWordFile=WordDoc.expandpath
Word.Document doc = app.documents.Add()
doc.DefaultTabStop=app.Application.CentimetersToPoints(0.74) ;;Default tab width
app.Selection.Font.Name = "Courier New"
app.Selection.Font.NameAscii = "Courier New"
app.Selection.Font.Size = 14
;_s.getclip
;;out _s
;_s.findreplace("e0e0e0" "ffffff") ;;Set the underline color to white
;_s.setclip
app.Selection.Paste() ;;Paste text
doc.PageSetup.LeftMargin=app.CentimetersToPoints(1)
doc.PageSetup.TopMargin=app.CentimetersToPoints(1)
doc.PageSetup.RightMargin=app.CentimetersToPoints(1)
doc.PageSetup.BottomMargin=app.CentimetersToPoints(1)
doc.SaveAs(vWordFile)
app.Quit()
run vWordFile
Macro test