Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
save QM code as a word file
#1
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]
Macro Macro9
Code:
Copy      Help
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
Code:
Copy      Help
int h = id(2210 "Quick Macros")
int y = 10
;Click 5 times, each time adding 16 to y
rep 5
,lef 50 y h
,0.5 ;;wait 0.5 s
,y + 16
;Select text
lef+ 20 15 h
lef- 20 80 h


Messages In This Thread
save QM code as a word file - by macman - 01-18-2021, 08:05 AM
RE: save QM code as a word file - by macman - 01-19-2021, 12:53 AM
RE: save QM code as a word file - by Kevin - 01-19-2021, 01:37 AM
RE: save QM code as a word file - by macman - 01-19-2021, 03:09 AM
RE: save QM code as a word file - by Kevin - 01-19-2021, 05:33 AM
RE: save QM code as a word file - by macman - 01-19-2021, 11:07 PM
RE: save QM code as a word file - by macman - 01-20-2021, 08:37 AM
RE: save QM code as a word file - by macman - 01-21-2021, 05:29 AM
RE: save QM code as a word file - by Kevin - 01-21-2021, 08:29 AM
RE: save QM code as a word file - by macman - 01-21-2021, 08:39 AM
RE: save QM code as a word file - by macman - 01-21-2021, 10:12 AM
RE: save QM code as a word file - by macman - 01-22-2021, 06:25 AM
RE: save QM code as a word file - by Kevin - 01-22-2021, 11:44 PM
RE: save QM code as a word file - by macman - 01-23-2021, 12:34 AM
RE: save QM code as a word file - by Kevin - 01-23-2021, 12:42 AM
RE: save QM code as a word file - by macman - 01-23-2021, 12:49 AM
RE: save QM code as a word file - by Kevin - 01-23-2021, 12:53 AM
RE: save QM code as a word file - by macman - 01-23-2021, 12:58 AM

Forum Jump:


Users browsing this thread: 3 Guest(s)