Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
convert the with statement in VBA into QM code
#2
The above implementation process is a bit cumbersome, If someone can implement the above VBA code function with QM regular expression, it would be great Smile

@Kevin
Can you give it a try?  I don't quite understand regular expressions at present
Do this in the following code



Macro Vba2Qm
Code:
Copy      Help
_s.getsel


;Using regular expressions to process such as with. if. statements
;It's like VBA Macros VbaWith2Qm


;Replace some keywords
_s.findreplace("True" "TRUE") ;;replace True
_s.findreplace("ActiveDocument" "doc") ;;replace ActiveDocument
_s.findreplace("Paragraphs(" "Paragraphs.Item(") ;;replace Paragraphs(
_s.findreplace("InchesToPoints(" "app.InchesToPoints(") ;;replace InchesToPoints(
_s.findreplace("If" "if") ;;replace If
_s.findreplace("Else" "else") ;;replace Else

;Add word app statement
str s=
;;/exe 1
;;Use /exe 1 to run the macro in separate process, as User. This macro may not work without it.
;typelib Word {00020905-0000-0000-C000-000000000046} 8.0
;Word.Application app._getactive
;app.Visible = TRUE
;Word.Document doc=app.ActiveDocument
s.addline(_s)
mes s

;Prompt for next step
int i=ListDialog("New macro file[]Save to clipboard" "How to operate?")
if i=1
,newitem("vba_macro" s "Macro" "" "" 4)
else if i=2
,s.setclip


Messages In This Thread
RE: convert the with statement in VBA into QM code - by macman - 01-24-2021, 10:53 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)