I am trying to build a function that returns the description a built-in worksheetfunction's argument using worksheetfunction's name and field position as inputs.
GetExcelArgumentDescription("IF",1) should return "logical_test"
GetExcelArgumentDescription("IF",2) should return "value_if_true"
GetExcelArgumentDescription("IF",3) should return "value_if_false"
I have seen this in add-ins like this one (screenshot).
Is is possible to get this argument description (screenshot) via VSTO? How does the code look like in vb.net?
The worksheetfunction property of Excel is not an addressable collection. You can create your own list from Microsoft's listing. Then reference your own list.
Related
I've found a question in stackoverflow: "How can I build Word fields with VBA" by JonnyGold.
I'm interested in the same question, but possibly on other reasons. The answers to JonnyGold question doesn't satisfy me. I'm still in MS-word 2003. My problem is to construct a custom word field, which would recognize a bookmark name around cursor location, saves that name in some custom variable/property, so that in a case of need a hyperlink of ref field could return a cursor to the said bookmark.
I need that mechanism to facilitate an easy work with a list of bibliographic sources, so that a user can by one click to go from a reference to a source and then to return back. Note that one source could be referenced in several different places and a user should be able to return to a reference, he/she clicked before.
I tried to use REF field with MACROBUTTON field inside, but MACROBUTTON requires double or one click on a button/text, which I want to avoid. I would like to create a field {RUNMACRO MacroName}, which would run a specified VDA Macro.
I want to set the name of the text box so it can be easily accessed by code.
e.g
I am looking for an editing field similar to this
Thanks
There's a properties Window that can be accessed for each of the controls on the UI. There you may rename the controls. (Since you do not seem to have a VBA code yet and you want to rename the control from UI)
The other alternative. Record a macro, do some changes to the textbox (e.g. resize, change text etc). Then check the programme assigned default name of the textbox from the VBA editor. As you said, you can access the control via this default name and utilizing your VBA code (as you said), rename the textbox.
If you really want to be editing a worksheet object in Publisher you will have to get the OLEobject of the Shape and interpret it as an Excel.Application.
If you are just looking for a placeholder solution for Publisher documents, you could simply create a textbox that contains a certain string, then loop through all pages, all shapes on each page where HasTextFrame = msoTrue, and compare shape.TextFrame.TextRange.Text to your placeholder string. If it's the one you're after, you can do anything you want with the shape in question.
Sorry for the vague answer, but your images don't work anymore.
Edit: you can work with Shape.Name for your comparison (you mentioned this property in a comment), but I have no idea how you'd set the value from the interface, without using VBA, in the first place, so if you're making templates the approach I outlined above might be easier for users (see https://msdn.microsoft.com/EN-US/library/office/ff939233.aspx for Shape.Name). There is also a .Name property for page objects (https://msdn.microsoft.com/EN-US/library/office/ff940382.aspx), so you should be able to do something like ActiveDocument.Pages("page_name").Shapes("shape_name").TextRange.Text = "your content" once you've figured out how to actually set the name values
Edit 2:
You can also try to use search and replace as per Replacing Text in Microsoft Publisher Using Powershell if you don't need to do anything advanced beyond placing some text
Edit 3: Given the title of your question, unless you can figure something out with Publisher's interface, you can set the .Name property of the selected text box (or other shape) with dim shape = Selection.ShapeRange.TextFrame.Parent and shape.Name = "your_name". You can set the name of the selected page with ActiveDocument.ActiveView.ActivePage.Name="your_name". (Create a VBA macro that prompts you for names and you should be good to go)
I'm currently doing enhancement on a vb.net project by using reference Interop.Microsoft.office.interop.word. Now i able to print out a document and there are few bookmarks in the generated document. Is there any way to retrieve those bookmark's page number? In summary, i want to know the page numbers where those bookmarks are.
I have found the solution as below:
GetPageNumberOfRange(BookmarkA.Range)
Public Function GetPageNumberOfRange(ByVal range As Microsoft.Office.Interop.Word.Range) As Integer
Return range.Information(Microsoft.Office.Interop.Word.WdInformation.wdActiveEndPageNumber)
End Function
I'm using VSTO with Outlook 2007, in c#. I can execute an Outlook.Application.AdvancedSearch(), and get a table. I want to select the columns to access from the table using Outlook.Table.Columns.Add(). I can't seem to find a complete list of property names that I can pass to Add() (I'm only interested in mail items). I've guessed a few of the obvious ones (ReceivedTime, SenderEmailAddress, To, Subject, Body, EntryID). I was hoping to be able to get the (plain text) body of each email, but trying to add the property Body doesn't seem to work. Is it impossible to get Body as a column, or is it just under a different name?
The page Unsupported Properties in a Table Object or Table Filter says that Body should work for the first 255 bytes. That didn't work for me, but even if it did, that's not what I want. Thus, I get the EntryID property, then use mapiNameSpace.GetItemFromID(entryId, Type.Missing) to get the MailItem object, and get the (entire) plain-text body from MailItem.Body.
How can i get the text object so that i can use it in formula editor?
Text objects cannot be read or changed using the Formula Editor within Crystal Reports. If you want dynamic content that I would suggest using a Formula instead of a Text Object.
Rather bizarrely, you are able change a Text Object value at runtime using .NET
e.g.
rptObject.ReportDefinition.ReportObjects("Text1").Text = "Some dynamic content"