How to test Word Marco and PDFs with SpecFlow - vba

I have a Macro enabled MS Word document and I want to test it with SpecFlow. What is the best way to do this?
The tests would involve opening the Word document and interacting with a dialog box generated by VBA. The test would need to read and assert the text of messages displayed on the dialog box. The tests would also need to read and assert the content of new PDF files created by the Macro.

Related

how to run Acrobat Create New PDF or Convert to PDF using VBA in Outlook desktop version

We have a process where the user saves an email as a .pdf file. I have developed a script that pulls the information for the filename from the email and prompts the user for additional necessary information.
What I can't figure out is how to then have my VBA script select the appropriate Acrobat command in the Ribbon or right-click menu. I've tried executemso, but the msoid is a non-specific "CustomControl". Specifically, the Acrobat add-in adds another tab to the Ribbon called "Acrobat" which then has the option Selected Messages (dropdown) with Create New PDF. Typically, my users just right click the email and choose "Convert to Adobe PDF". A third option would be to programmatically select File | Save as Adobe PDF.
So ideally a user could select an email message and run my VBA macro and that macro would then continue the process to the convert to pdf. Another thought I've had is to somehow watch for the event of creating a pdf and to run the macro and copy the programmatically-created filename to the clipboard.
There is no trivial way to execute custom ribbon controls from other add-ins. You may consider contacting add-in developers for any public API in the add-in which you could call directly. Also you may take a look at the Accessibility API.
Instead, you can try using the Word object model for saving email as a PDF file on the disk. The Inspector.WordEditor property returns the Microsoft Word Document Object Model of the message being displayed. The Document.ExportAsFixedFormat2 method allows saving a document which represents the message body in PDF or XPS format.

How to use VBA to change the default MS Word 2016 options so that when you save as PDF the headings are included as bookmarks?

I'm using Microsoft Word 2016 and looking for a way to run a vba macro that will change the default option to Create bookmarks using: Headings when I save a document as PDF when I click on
File ->
Save As ->
PDF (*.pdf) ->
More options.. ->
Options
Note: The option is only available if you have a table of contents in the document.
The goal is that if a user chooses to save as PDF that option will be already checked.
I'm not asking how to do this manually, like in this question
nor programmaticaly save to PDF using vba like here or here.
Since it's not reachable by VBA at the point of save a file as PDF I do not see it as possible to change that PDF saving option using only VBA.
The only way I see you can reach the behavior you seek is as follow but need some special effort. You need to either create a VTSO addin or be able to have an extra marco file in the Microsoft Word Startup-Path so it will be loaded at Microsoft Word Startup.
Re-implement your own "Save" behavior by overriding the Save functionality (BeforeSave) of Microsoft Word and provide it via your own Save-Button in the Microsoft Word-Menu described here

Save macro enabled document as new template

I created a Word 2010 template with macros and VBA code but then I amended one of the documents created from the template instead of the template and this included text boxes and drop down lists. How do I save the document as a new template with the macros maintained as well as the VBA and components such as text boxes etc. When I try and save the document as a .dotm file the option to place in Design Mode doesn't work and I have took the document out of Compatibility Mode.

PDF to Webpage Copy-Paste activity :: Process Automation

Help me choose a way through which I can achieve the following.The steps to be performed are listed below.
Steps
1)Open a PDF file .Copy the value of each cell one by one.Please find image of sample PDF file
2)Open browser URL https://docs.google.com/forms/d/1MWbMjCHgBUylLWo2fWeyZnoUsx33ewQ0S39_ykbWwYc/viewform and then paste the corresponding value of PDF in a webpage form.
3) After repeating the above process for all fields in PDF file,there is a 'Submit' button in the webpage form which needs to clicked upon.
The above steps need to be performed on all the PDF files under a folder.
Can Selenium be used for this task or some other automation tools??
If selenium can be used, request to brief the process.
Regards,
Sri

Generate pdf through microsoft word

I have a Microsoft word document with 58 pages when I generate pdf file with word itself or doPDF or other softwares, they generate pdf file with 61 pages. How can I solve this problem.
My document written in Persian language.
Word loves to reformat the document whenever something is changed in the printer settings (such as selecting another printer). You might make sure that you have the printer driver used for doPDF active when you edit the document, and invoke the Print command.
You may also make sure that the page sizes selected in the print dialog correspond to the one of the document.
You can also, make sure that you have written the document using word's ability to end (break pages) that way you will make sure that the pages you have are not moving, especially the figures.