Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
hello Developers
I have macros that exports chars to word and excel. 3 Days back it worked fine,but today when i tried the macro is opening excel and word but its exporting script to that word and excel. Any help please.
Thanks
Anil
Hi Anil,
please attach macro code or sample app in order to help you finding the solution.
Kind regards,
Can you post the Macro you using?
Hi
Please see the below script:
Sub Test
Set XWord = CreateObject("Word.Application")
XWord.Visible=true
Set DocWord = XWord.Documents.add()
With XWord.Selection
'.InsertBefore "Titulo"&chr(13)
'.Font.Bold = True
'.Font.Color = RGB(243,58,160)
'.Font.Size = 12
'.Font.Name = "Georgia"
.Collapse wdCollapseEnd
End With
ActiveDocument.ClearCache
ActiveDocument.GetApplication.WaitForIdle
set image = ActiveDocument.GetSheetObject("CH822")
image.CopyBitmapToClipboard
XWord.Selection.Paste
With XWord.Selection
XWord.Selection.Collapse wdCollapseEnd
XWord.Selection.InsertBefore chr(13)
' .InsertBefore "My Chart"&chr(13)
'.Font.Bold = True
'.Font.Color = RGB(243,58,160)
'.Font.Size = 15
'.Font.Name = "Georgia"
.Collapse wdCollapseEnd
end with
ActiveDocument.ClearCache
ActiveDocument.GetApplication.WaitForIdle
set image = ActiveDocument.GetSheetObject("CH824")
image.CopyBitmapToClipboard
XWord.Selection.Paste
ActiveDocument.ClearCache
ActiveDocument.GetApplication.WaitForIdle
set image = ActiveDocument.GetSheetObject("CH827")
image.CopyBitmapToClipboard
XWord.Selection.Paste
ActiveDocument.ClearCache
ActiveDocument.GetApplication.WaitForIdle
set image = ActiveDocument.GetSheetObject("CH829")
image.CopyBitmapToClipboard
XWord.Selection.Paste
ActiveDocument.ClearCache
ActiveDocument.GetApplication.WaitForIdle
set image = ActiveDocument.GetSheetObject("CH831")
image.CopyBitmapToClipboard
XWord.Selection.Paste
ActiveDocument.ClearCache
ActiveDocument.GetApplication.WaitForIdle
set image = ActiveDocument.GetSheetObject("CH832")
image.CopyBitmapToClipboard
XWord.Selection.Paste
ActiveDocument.ClearCache
ActiveDocument.GetApplication.WaitForIdle
set image = ActiveDocument.GetSheetObject("CH833")
image.CopyBitmapToClipboard
XWord.Selection.Paste
end sub
Hi mate,
i've made a little adjust in the macro and it works perfectly in one of my applications, in my case it only exported the two first objects, this is what i did:
With XWord.Selection
.InsertBefore chr(13)
.Collapse wdCollapseEnd
end with
Please let me know if this helps.
Kind regards,
Hi Santiago
Thanks for the reply. I am not sure what's happening in my application. It's working now without any change. Do you have any idea why the macro's are not working some time?
Thanks
Anil
Hi Anil,
it may depend on a lot of things but when this kind of strange behaviour in QV starts to appear is when i have my pc on for a lot of days wothout any reboot and QV starts acting crazy.
Besides that, without further investigation i dont know what could be the cuase of your issue.
Kind regards,