How to see Word .doc variables - variables

Is there any possibility to see doc variables? It's Microsoft Word 2003, I have added a doc variable in a document, but if I take a look at the document I can't see there any variables. Is it possible to turn document variables visible?

I solved it myself. To change fields visible mode you should use ALT+F9

Related

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

How do I change selected text's font in Outlook

How do I set the font of selected text in Outlook's HTML editor? I found a couple of answers on google, but none of them worked.
What version of Outlook are you using? In case of Outlook 2010 and up, Outlook always uses the Word editor and you can access it Application.ActiveExplorer.WordEditor, which returns an instance of the Word's Document object. Once you have it, you can use the Word object model to change the selected text attributes.

How do I style a word document exported from a webpage in VB.Net

I'm trying to export text retrieved from a database into a word document in VB.Net and while I have a working example, I need to figure out how to style some sections of the document appropriately.
I have found a few working examples from MS Online resources (such as this one), which I've found can cover some basics:
para.Range.Text = "Quad Chart"
para.Range.Style = "Heading 1"
para.Range.Bold.Font = True
But it doesn't cover even some of the simplest of formatting such as:
How you align the text (left, right, center)?
How you specify letting?
How do you start a list style?
What I'm trying to find is either a straight answer to these or (even better), a definitive list of the commands that would allow most any formatting.
Also, I would prefer not using Spire, which seems to be a common answer.
Thanks!
The VBA object model describes all the classes, their methods and properties that you can use for the marking up of content.
Your suggestion to use styles is strongly recommended as a way of separating your code from the presentation. Create a document template (.dot or .dotx, depending on Word version) and attach this to your documents. Then, when the document is opened, it will inherit layout and presentation from the template and be correctly rendered.
The list creation is a little intricate as you will need to restart the list if you are using numbering.
If you are interested in a completely different approach, you can look at Applying an XSLT Transform in the Microsoft Office Word 2003 XML Software Development Kit. This describes how to generate XML documents and using XSL transforms to describe the presentation. More general, but definitely more complex to set up.
Your preferred approach will depend on whether you want to generate native documents with a template, or to require your users to install the transform using the tools in the SDK.
So, you have a few examples. Office VBA is a cut down version of VB6, so why not record some macros in Word, open the VB editor and look at what it does. It's also the easiest way to navigate the help on the Word object model.

How to save options of a VSTO add-in in the currently open file?

I'm building a VSTO add-in for Powerpoint 2010 and the options the add-in sets apply to the currently open file instead of a per-user config. Can I save these options in the current file (I mean, add custom XML to the .PPTX file)? If so, how?
Thanks for your help.
For very simple data, custom properties are ok (so long as you're aware that anyone who opens the file will be able to see, edit and delete them). And note that because PPT shares a common, too-small, allocation of data between links and document properties, adding too many of one can wipe out the other.
I'd use tags instead. Every shape, slide and presentation object can have a tags collection, containing one or more Name / Value pairs of strings.
These are invisible to the user and will not interfere with the hyperlinks in the presentation.
' To add a tag
With ActivePresentation
.Tags.Add "MyTagName", "MyTagValue"
End With
' To use a tag
If ActivePresentation.Tags("MyTagName") = "MyTagValue" Then
' Do something or other
End If
If your Options are not too complex, I would go for Document Custom Properties. The following question illustrates how to use Custom Properties with Excel, they are supported in PowerPoint as well so this should provide a good starting point!

How to get the template path of a word 2003 document

When I create a new document based on a template (*.dot), I need to know on which template is the document based on.
Is there a way to find out with VBA which template was used for creating this new document? I need the complete path to the template.
ActiveDocument.AttachedTemplate.FullName
You may also use a built-in document property to access the template name: ActiveDocument.BuiltInDocumentProperties(wdPropertyTemplate)
I don't remember why theres has been sometimes differences between the two results; you must try it out. please be aware that accessing sometimes the built-in properties sets the document in a dirty state, so that it is useful to save the ActiveDocument.Saved state before and reset it after having accessed the property.
[UPDATE]
I've had again a look into the way you're creating the documents. If it's at your customer with 38.000 templates, I guess your problem are "fake" templates. I've just did a test with Office 2003:
Create a new document "TestTemplate.doc" with same content and save it as doc file. Close it.
Go to Windows Explorer and rename the document to "TestTemplate.dot". This provokes Windows Explorer to treat it as a template, not as a document. The default DDE command for templates is not "OPEN", but "NEW", what you can also see if you do a right-click on the file ("New" is bold, while with documents "Open" is bold).
Double-click the fake template: Word creates a copy of the document, so a new file named "Document2" or whatsoever.
Go to the VBA Editor, and type ?ActiveDocument.AttachedTemplate, and you'll see "Normal" as answer. Type ?activedocument.Type = wdTypeTemplate and you'll see "False" as answer.
Sp I guess the documents "Without template" are only copies of other documents, and not of templates. So you have no way to find the base template.