Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
PEyzaguirre
Partner - Contributor
Partner - Contributor

Problems with Macro Word

Hi, I have a macro that exports images and texts to a template generated in ms word. Until a while ago it worked without problems, but it began to fail. Some instructions  are not executed correctly, particularly "appWord.Selection.MoveDown wdLine, 85" since it does not advance the indicated lines (85) but a smaller amount of lines. This instruction is in other parts of the code and works perfect. Attached part of the code that does not work.

Dist_Traf_Entrada_Tit1=ActiveDocument.Variables("Dist_Traf_Entrada_Tit1").GetContent.String
ActiveDocument.GetApplication.WaitForIdle
appWord.Selection.MoveDown wdLine, 85
appWord.Selection.EndKey
appWord.Selection.TypeText Dist_Traf_Entrada_Tit1
ActiveDocument.GetApplication.Sleep 500

appWord.Selection.MoveDown wdLine, 2
appWord.Selection.EndKey
ActiveDocument.GetSheetObject("CH123").CopyBitmapToClipboard
ActiveDocument.GetApplication.WaitForIdle
appWord.Application.Selection.Paste
ActiveDocument.GetApplication.Sleep 500

 

Anyone who has any experience about it?, Sorry for the language but I use google translate.

 

Thank you

 

 

 

 

Labels (1)
2 Replies
m_woolf
Master II
Master II

vbscript doesn't know what wdline is. Try putting a 5 in place of wdline

https://docs.microsoft.com/en-us/office/vba/api/word.wdunits

PEyzaguirre
Partner - Contributor
Partner - Contributor
Author

 
Hi, sorry for the delay. wdline is a previously defined constant, just with value 5.