vb.net or PS script to past value to a program form... - vb.net

I have an older program I think was developed/complied using C++ that tracks sellable items we have. We enabled an option in the programs preferences that allows us to use an alternate sort field for reporting and inquiries. This field can contain any alpha/numeric value, but cannot be 'Blank' NULL.
However, when we enabled this feature, and we realize now we can’t un-enable it. Each item records (14,000+) now contain a "blank" NULL value for this field. At this point none of our reports will run and we get an error indicating: "Alternate Sort value can't not be NULL" So it looks like I will need to manually enter a value in the 'blank' NULL field.
I have a text file with the values for each record in the same order as they are displayed on the entry grid in the program. The database is propitiatory and there are no db tools provided to us that will allow us to import the values directly.
Does anyone know of a way to use vb.net or a PS script to basically read a value from a text file and then paste it where the cursor is on the screen and then send an {ENTER Key}, and then repeat the process?
Thanks

Related

MS Word VB make check box control invisible when merge field is null

I have a query that pulls information I need to use in a mail merge document to email to people for verification of information. There are 8 fields they need to verify, preferably with a check box control, but some of the fields contain no information. I would like to make the check box next to merge fields that contain no data (or whatever I may need to write into the query to make this work) invisible. If this could be accomplished easier in a completely different way, that would be fine too. Thank you.
As Cindy said, this kind of thing is handled via field coding in the mailmerge main document, not via VB code. Such a field might be coded as:
{IF{MERGEFIELD myCheck}<> "" "[ ]"}
or:
{IF«myCheck»<> "" "[ ]"}
where 'myCheck' is the field name and '[ ]' is the checkbox content control.
Note: The field brace pairs (i.e. '{ }') for the above examples are all created in the document itself, via Ctrl-F9 (Cmd-F9 on a Mac or, if you’re using a laptop, you might need to use Ctrl-Fn-F9); you can't simply type them or copy & paste them from this message. Nor is it practical to add them via any of the standard Word dialogues. Likewise, the chevrons (i.e. '« »') are part of the actual mergefields - which you can insert from the 'Insert Merge Field' dropdown (i.e. you can't type or copy & paste them from this message, either). The spaces represented in the field constructions are all required.

VB.net - Search the whole registry for a value only?

So I'm trying to make a programm that searches the WHOLE registry for one specific value WITHOUT declaring the location of the key. It should just search for the value and print it in a msg box but the only way I found was to declare the location and search for the key then. The code should also take the value of a text box and search for this specific value. I don't really know what I could possible do next so I'm trying to get some help from you guys. If you have snippets, articels or smth like that pls send it 2 me :)

VBA - Word Table : default value and combo box

I have Word Tables, and I don't find how to affect default values for certain columns...
When inserting a new line, I would like a certain column to have a certain drop-down list without user having to do it himself.
To illustrate my thoughts, here is a small image of what I'm looking for
I really don't find how to manipulate my table for it to ends up like this, so I would like to request your help.
When looking on the web for this, I only find information about table default style and no default Value.
So I would like to ask. Is this possible? If yes, how to do it?
I am looking for either a VBA code to set my column default value (which would be great), or even a way to do it in Word GUI at first. Or, obviously, an answer that would tell me that it is impossible to do in Word.
PS: the extremely easy equivalent in Excel of what i'm looking for:
Thanks in advance!
In the GUI:
Click the cell where you would like your dropdown.
In menu, switch to "Developer Tools"
Insert a Dropdown control ("Controls" are, the one in the middle)
In the ribbon, click "Design mode" (I have German Word so the actual name might differ), "Properties"
Now you can enter your options
Alternatively via VBA, I got this with the macro recorder; should give you a start:
[Cell].Range.ContentControls.Add (wdContentControlComboBox)
ActiveDocument.ToggleFormsDesign
Selection.ParentContentControl.DropdownListEntries.Clear
Selection.ParentContentControl.DropdownListEntries.Add Text:="Yes", Value _
:="Yes"
Selection.ParentContentControl.DropdownListEntries.Add Text:="No", Value:= _
"No"

Google Apps Script on Form Submit Time Formatting Glitch/Fix

Background:
How: I suspect that this is a glitch within Google Form (submission process)/Spreadsheet, but may be part of the Date conversion utility of the Spreadsheet interface (and is an intended feature).
When entering a format in a text box in Google Forms, there is some sort of communication error between the Form submit and Response Spreadsheet, or pre-processing of the Form's data before it is sent to the spreadsheet. The glitch only seems to happen for data in a text field of the format ##:## TEXT where TEXT contains no '.' characters. For example: 4:15 pm will reproduce the glitch, but 4:15 p.m and 4:15 p.m. will not.
Result: An apostrophe character is added to the beginning of the string when it is put into the Spreadsheet (i.e. '4:15 pm) which throws off several sub-systems I have in place that use that time data. Here are two screenshots (sorry for the bad sizing on the second):
I'm 99% certain that the glitch is caused by the ##: combination.
Temporary Fix?: The real question is... how might I go about removing that pesky apostrophe before I start manipulating the time data? I know how to getValue() of a cell/Range. Assume I have the value of a cell in the following manner:
var value = myRange.getValue();
// value = '4:15 pm
How can I go about processing that value into 4:15 pm? A simple java function could be
value = value.substring(1); // Assuming "value" is a String
But in Google App Scripts for Spreadsheets, I don't know how I would do that.
Post-Script: It is necessary to post-process this data so that I don't have to lecture university faculty in the language department about inputting time format correctly in their forms.
Thanks in advance to those who can help!
How can I go about processing that value into 4:15 pm? A simple java
function could be
value = value.substring(1); // Assuming "value" is a String But in
Google App Scripts for Spreadsheets, I don't know how I would do that.
Google Apps Scripts uses Javascript which has the exact same method.
value = value.substring(1);
should return all except the first character.
More about Javascript substring at: http://www.w3schools.com/jsref/jsref_substring.asp
If you remove the ' in the spreadsheet cell the spreadsheet interface will convert this entry to a date object.
This might (or not) be an issue for you so maybe you should handle this when you read back your data for another use...
It doesn't happen when text is different (for example with P.M) simply because in this case the ' is not necessary for the spreadsheet to keep it as a string since the spreadsheet can't convert it to a date object (time value).
Artificial intelligence has its bad sides ;-)
edit :
You cant do this in an onFormSubmit triggered function using the javascript substring() you mentioned. If you're not familiar with that, here is the way to go :
To run a script when a particular action is performed:
Open or a create a new Spreadsheet.
Click the Unsaved Spreadsheet dialog box and change the name.
Choose Tools > Script Editor and write the function you want to run.
Choose Resources > Current project's triggers. You see a panel with
the message No triggers set up. Click here to add one now.
Click the link.
Under Run, select the function you want executed by the trigger.
Under Events, select From Spreadsheet.
From the next drop-down list, select On open, On edit, or On form
submit.
Click Save.
see doc here and here

Printing custom ranges or items in Word 2010 using VBA

I am fairly new to VBA (Word 2010) and I'm unsure if something I'd like to do is even possible in the way that I want to do it, or if I need to investigate completely different avenues. I want to be able to print ranges (or items) that are not currently enumerated as part of either wdPrintOutRange or wdPrintOutItem. Is it possible to define a member of a wd enumeration?
As an example, I'd like to be able to print comments by a particular user. wdPrintComments is a member of the wdPrintOutItem enumeration, but, I only want comments that have an Initial value of JQC. Can I define a wdPrintCommentsJQC constant? My code is reasonably simple; I have a userform that lets the user pick some settings (comments by user, endnotes only, etc.) and a Run button whose Click event should generate a PrintOut method with the proper attributes. Am I on the wrong track?
(If it matters, the Initial values will be known to me as I write the code. I have a discrete list.)
No, it's not possible to add a constant to a predefined enumeration type.
However, one possible way to do this would be to build a string of page numbers which contain the items you wish to print, open the print dialog in the "dialogs" collection, and set it to print a specified range, andinsert the string containing the list of pages (separate them with commas). Finally, execute the .show method of the print dialog to show it to the user and give them the opportunity to set any other items and click the "ok" button. I've done something very similar when I needed to print a specific chapter of a long document, and so I had to specify the "from" section and page and the "to" section and page for the user. Below I just show how to specify a list of pages instead of the ".form" and "to" I was using:
With Dialogs(wdDialogFilePrint)
.Range = wdPrintRangeOfPages
.Pages = "3,5,7-11"
.show
end with
I'm not sure how you want to print the comments (or other elements), but you could create another document and insert what you want to print on this document.
According to what you want, you could insert them as they were (comments, footnotes, etc) or as plain text, or any other format.