Start Word without any popups - vb.net

I am about to create a VB.NET Application that is able to automatically format Word documents or change specifical things in it. But the applications stops regularly working because Word (working in Background, not visible) opens popup Dialogs, e.g. if the document is a .odt file, or was downloaded from the internet, or even the "Save File" dialog.
Is there any possibilty to prevent Word from opening any of these dialogs?
I haven't found anything in the MSDN Developer Reference concerning this subject either.
Does anybody have an idea how to do this? Thanks in advance.

I haven't done this with Microsoft Word, but I have done something similar in doing COM automation with Microsoft Project from .NET. Below is the code fragment that turns off all sorts of annoying pop-ups from MS Project:
mApp.DisplayAlerts = False
where mApp is Microsoft.Office.Interop.MSProject.Application

Related

Word Save Template command returning error

I recently discovered the blissful convenience of being able to use the File, Save command from within the VBA Editor window to save the currently attached template without having to actually be in the template or close out of Word.
I thought it would be nice to have this command available on a Ribbon Tab or the QAT or even a keyboard shortcut, so I first added the Save Template command to a Ribbon Tab. But when I clicked on the tab, nothing happened.
I thought perhaps I needed to tweak things a bit with a macro, so I recorded a macro and clicked on the command, to see what the VBA statement would look like.
It looks simple and straightforward enough, very similar to a bazillion other "ActiveDocument" macros I have stored that run without any issues:
ActiveDocument.AttachedTemplate.Document.Save
But when I run the macro, I get the standard "Runtime error" message, with no hint as to what is wrong.
I cannot find any documentation regarding this command in any of my source material or anywhere on Google, nor can I find any discussions about it.
Any ideas what's missing here? Thanks in advance!
As I discovered, and Cindy Meister confirmed, the following works:
ActiveDocument.AttachedTemplate.Save
It will work even if the template is closed. The version that you got from the Macro Recorder, ActiveDocument.AttachedTemplate.Document.Save works only if the template is open. The version above works whether it's open or not. I don't program much in Word, but it looks like a template's Document object/property is instantiated when the template is opened and otherwise is nothing.

Access 2007 – Unable to Get "AcrobatPDFMakerForOffice" to Work

I am trying to help a small company that is using an .mdb database in Access 2007. Their previous programmer left little documentation, unfortunately. The problem occurs when they call some routines that are intended to create a PDF file from an Access report. The routines were written by Stephen Lebans, and are supposed to be safe and stable. The Lebans routines are called by VBA code.
Here is some more info. The company has a small network with two workstations. On one workstation everything works fine; it is able to call the Lebans routines and create a PDF file. On the second workstation the code appears to execute but no PDF is created. Adobe Acrobat DC was installed recently on both PCs. The problem creating PDF files on PC#2 began after they installed Acrobat DC.
I will probably call Adobe tech support to get their help. But before that I hope someone can help with several questions I have.
Question 1 - In the VBA editor, in Tools -> References, I see that "AcrobatPDFMakerForOffice"
is checked. Please let me know if I should have checked some other reference instead.
Question 2 - The "AcrobatPDFMakerForOffice" in Tools - > References seems to refer to the following file: "c:\Program Files (x86)\Adobe\Acrobat 2015\PDFMaker\Office\AcrobatPDFMakerForOffice.tlb" ,
which is a type library file. Does that seem OK? Or should it point to a "dll" or "exe"?
Question 3 - On PC#1, which is creating PDFs correctly, if I click the Office button inside Access,
select Access Options, then select Add-Ins, I see "Acrobat PDFMaker Office COM Addin" under the heading "Active Application Add-Ins". And the file it refers to is:
"c:\Program Files (x86)\Adobe\Acrobat 2015\PDFMaker\Office\PDFMOfficeAddin.dll".
On PC#2, however, there is nothing listed under "Active Application Add-Ins". So I attempted to add it.
I clicked "Go" next to "Manage COM Add-Ins" at the bottom of the screen; then clicked "Add..." in the
"COM Add-Ins" window that appeared; then navigated to the file "c:\Program Files (x86)\Adobe\Acrobat 2015\PDFMaker\Office\PDFMOfficeAddin.dll"; then click "Add". But nothing appeared under the heading "Active Application Add-Ins".
Any thoughts on how I can add "PDFMOfficeAddin.dll" to the Active Add-Ins list; or if I need to at all?
Thank you!
Cross Posted Here https://www.access-programmers.co.uk/forums/showthread.php?t=295390
As pointed out in that post Access can create a PDF natively now. There is no need of the Lebans code.

Where do I put macros (besides in normal) so they are always available in word 2013?

I had a bunch of macros that I had in C:\Users\userx\AppData\Roaming\Microsoft\Templates that were always available in word 2010 but since upgrade to word 2013 I cannot run them. Word apparently does not automatically load them anymore. I used to just do alt F8 and pick from the list. I also had a few added to the quick options bar but they are gone also.
Searched this site and MS website and can't seem to find a solution. Is there another location that I need to move the files containing the macros to or is there some other action that I need to take so I can run them again?
My guess is this is already answered here and I am just not searching for the right things. My apologies if that is the case, please just point me to the appropriate post.
You can place a shortcut to the templates containing your macros in the following location
C:\Users\%username%\AppData\Roaming\Microsoft\Word\STARTUP
That will make your macros available whenever Word opens and restore the Alt+F8 functionality you're looking for. If you add toolbars to your templates, those will also automatically be attached to the Normal template when you open Word.

Looking for a simple rich-text editor usable from VBA

I'd like to allow my users to enter rich text (with bold, italic & underline, but probably nothing more than that) in an entry box on a VBA userform.
I don't want the user to have to install anything, so I need this to be something that leverages what Office or Windows already provide. The obvious candidate is the Windows built-in Rich Edit control.
I did a quick test and verified that I could create a window of this type from VBA, but what it then lacks is all the UI, etc. I could really use a leg-up as to how I then turn this into something usable.
I'm happy to consider alternative controls, so long as they're guaranteed to require no installation (other than as part of the Excel file containing the rest of my VBA code). It needs to work on Windows XP and up, and Office 2003 and up.
You could just try making a simple UI yourself. Add a command button to the form that will bold the selected text in the rich edit control. Or add a command button that will italicize or copy or paste. Your imagination is your limit.
I was checking Rich Edit Version 1.0 in Excel 2010, and I could access the text in the control.
For anyone searching for this still. As Gary McGill stated, "Microsoft InkEdit Control" is your best option.
Use the link below for a reference on the variables it can use:
https://www.thevbprogrammer.com/Ch10/10-06-RichTextBox.htm
With the Toolbox window open in Excel's Visual Basic editor, select Tools->Additional Controls from the menu. Check the box next to MSREdit Class. This will add the rich text control to your toolbox. From there you can add it to a UserForm.
I tested this control in both Office 2003 on Windows XP and Office 2010 on Windows 7. It looks like you'll still need to provide the UI for allowing the user to toggle bold, italics and underline.
It does accept a paste (via Ctrl+V) of some rich text that I copied from Word, but I couldn't figure out how to make it switch font formating while typing text into the control.
Putting this here just to rule it out...
It seems that the "Microsoft InkEdit Control", which is available from "Additional Controls" on the toolbox, is a superset of the Rich Text Edit control (as the name suggests, it also supports Ink).
It's hard to tell whether this is widely installed - it is on my XP/2003 machine, but not on my 2K/2K machine. (I've seen it said that it's installed with Vista and Win7, but clearly there are earlier versions too).
Anyway, I'm ruling this out because using the control results in a message at runtime to the effect that the ActiveX control is "unsafe" (presumably related to the well-known issue with the Rich Text Control itself).

How do you hyperlink to Word 2007 help pages?

I want to hyperlink to a page within the Word 2007 Object Model Reference documentation, that ships with Word 2007. These are webpages that use the ms-help:// protocol that Firefox cannot understand.
So I wanted to specify the ms-help:// path of the help page as a command line argument to the viewer, CLVIEW.EXE.
C:\Program Files\Microsoft Office\Office12\CLVIEW.EXE
Does anybody know the command line syntax for this?
CLVIEW.EXE doesn't support command line parameters to launch to a certain page. It's usually used to launch your own custom help file within the hosted Office application.
With Word 2007 there are some options available. They depend, let me repeat, they depend on whether your help is in online or offline mode.
If your intent is simply to get
people to a specific Word help page
and they have internet access, you can grab the URL from the help file
in online mode. To do this,
just right-click on the page you
want the link, for example the
Make the text bold page, to and click Properties. Then copy the URL
(Address) which is:
http://office.microsoft.com/client/helppreview.aspx?AssetID=HA100215341033&ns=WINWORD&lcid=1033. This will work just fine in FF (if you were in Offline mode, this
same link would have been:
ms-help://MS.WINWORD.12.1033/WINWORD/content/HA10021534.htm.)
If you are first sending them to
Word, you can run an macro that
brings up this topic. You grab the
"Topic ID" from right-clicking on
the page Make the text bold page
(which, in this case is
"HA10021534") and put that ID as the
first parameter, like the below.
NOTE: This should work in both
online and offline mode.
Sub DisplayHelpTopic()
Application.Assistance.ShowHelp "HA10021534", ""
End Sub
For developer documentation with the
solution for #2, if you are in
offline mode, you need to set the
scope to "DEV" (which will also work
if you are in online mode). So for
the subject Bibliography Object,
the Topic ID is: HV10096617. If you
are in online mode, you don't need
the "DEV" scope. Code:
Sub DisplayHelpTopic()
Application.Assistance.ShowHelp "HV10096617", "DEV"
End Sub
You can view these documentation pages in Internet Explorer.
Open up your Word docs to the page you want.
Right click, Properties and copy the ms-help:// URL.
Paste this URL in IE, it should open up fine.
Use the command line syntax for IE to hyperlink to it.
Hope that helps, although clicking links in IE may not work properly.
Maybe CLVIEW.EXE has command line syntax that can do this directly.