I get the type not defined error for XlEnableCancelKey when trying to use ShellAndWait with MS Word VBA. The Xl part of XlEnableCancelKey looks like it maybe an MS Excel type.
Also asked on MSDN VBA Forum.
Yes
In the VBA project, add a reference to the Microsoft Excel 12.0 Object Library.
Use WdEnableCancelKey instead of XlEnableCancelKey.
The reason being, for word a different enum type is defined which is used for Application.EnableCancelKey.
EDIT: Having looked at the link, I saw this line.
Application.EnableCancelKey = xlErrorHandler
Effectively, the code is wanting to use an enum value for EnableCancelKey.
Hence, you can use WdEnableCancelKey in place of XlErrorHandler.
Related
I've got a function where I want to determine if all the digits after the first are numbers. To do so, I thought I could use Text.InferNumberType which, per the documentation, should raise an error if the text is not a number.
Here is my code snippet:
a= Text.Start(Argument,1),
b= Text.End(Argument, Text.Length(Argument) - 1),
c= try Text.InferNumberType(b) otherwise "FALSE" ,
Instead, I'm getting this Expression.Error which says:
Expression.Error: the name Text.InferNumberType wasn't recognized. Make sure it's spelled correctly.
I literally copied and pasted the function name from the reference document, so I'm sure it's spelled correctly.
I'm using PowerQuery in Excel 2013. PowerQuery was installed about a week ago using the latest download from Microsoft. I did search and found this question - I'm wondering if this is a similar issue? I don't see anything in the documentation though which says this function wouldn't be available in certain versions of power query.
This is likely an older function that isn't supported in Excel 2013. I'd recommend a different function like Number.From or Number.FromText, which have similar functionality.
Alright so I'm needing some help here. I working with Outlook 2007 PIA (Outlook add-in) and using the advanced search. I'm trying to write a DASL filter for the AppointmentItem property GlobalAppointmentID but I cannot seem to find the correct namespace to use in the filter.
I've tried urn:schemas:calendar:uid and I do not get any results when searching on the first appointment in the default calendar list. The MSDN documentation states that this is a mapi property but I am unfamiliar with mapi so at the moment I do not know how to even find it in the msdn that way (I tried and ended up way over my head).
I know there is a work around to go to the default folder and iterate through the collection to find the object that I need but I consider that too inefficient (I'm using it at the moment but want to improve it).
Any help would be appreciated!
OOM will not let you search for GlobalAppointmentId (or any other PT_BINARY property) in Items.Find/FindNext/Restrict. The only workaround is to either loop through all item in the Calendar folder (extremely inefficient) or search using Extended MAPI (C++ or Delphi only) or Redemption (I am its author - any language, its version of RDOFolder.Items.Find allows to search on GlobalAppointmentId or any other binary property)
Not every property can be used in a filter string for Items.Restrict, Table.Restrict or Application.AdvancedSearch methods. For both Jet and DASL queries, you cannot restrict on a binary property such as EntryID or GlobalAppointmentID. Also you cannot restrict or search for computed properties.
Anyway, you may find the Chapter 11: Searching Outlook Data helpful.
Problem: we are wanting to use SonarJS but much of our old Javascript code uses functions from the Microsoft ASP.Net framework (and the MS AjaxToolkit). As such we have a couple of hundred occurrences of the error "XXX" does not exist. Change its name or declare it so that its usage doesn't result in a "ReferenceError". (where XXX is Sys, Type, $get etc.).
I appreciate that I could suppress these by specifying them all in the sonar.javascript.globals property (as per the Elena Vilchik's answer to this question ) but it feels like what I really want to do is to add my own bespoke entries in sonar.javascript.environments (called msajax and msajaxtoolkit say). Then I could be more precise about when to include / exclude these globals.
So I guess I would like to know whether defining my own environment is supported or if there is a more elegant solutions overall.
Thanks in advance.
You are more than welcome to open pull request for https://github.com/SonarSource/sonar-javascript. Edit "javascript-frontend/src/main/resources/org/sonar/javascript/tree/symbols/globals.json" by adding new group/groups of names.
I am analyzing a VB system when I stumbled upon the following code snippet. This is my first time reading VB code and this may be a trivial question.
.
.
Format$(txt & "/02/20", "gee")
.
.
My question is, what does "gee" stand for? Is it a date format or something? I cannot find the string anywhere else in the code. If it is a format type, what could it possibly be its equivalent in Java? I found out that Format$ in VB functions similarly to Java String.format().
Here is what the VB documentation says about Format$():
Function Format$(Expression, [Format], [FirstDayOfWeek As VbDayOfWeek
= vbSunday], [FirstWeekOfYear As VbFirstWeekOfYear = vbFirstJan1]) As String
Member of VBA.Strings
Formats an expression
I solved it using Visual Basic's Immediate window. It seems that "gee" is used for conversion from the Western Date to Japanese Imperial years.
Using immediate window:
? Format$( "2012/02/20", "gee")
Output -> H24
Another example:
? Format$("123123123", "#,##0")
Output -> 123,123,123
NOTE:
It seems that the above example using "gee" does not work with PC's having different regional settings. My VB6 is in English but my OS is a Japanese Windows 7 Professional.
The code snippet will always evaluate to "gee". EDIT This turns out not to be the case, see nmenego's answer!
It sounds like someone was experimenting with the Format function, and forgot to delete the experiment from the code!
If you'd like to learn more about Format have a look at the full VB6 documentation on Format and the format specifiers for dates.
It comes up from time to time and I'm wondering of it's possible to use type info when searching in visual studio, or is there a plugin that includes this?
I'd like to search for the phrase
"x == "
or
"x.ToString();"
where x is of type 'Person'. The normal regex searches are strictly searching the text as opposed to the content and I figured out a long time ago that any thought I have is never the first.
The simple answer is no. If you wanted to do this kind of advanced searching you'd need to use Reflection to examine the type of the variable.
The Visual Studio automation object, EnvDTE, has some interfaces such as SolutionItem that can be used to examine code. You might look into that.