@RubberDuck just pushed 2 commits, fixes the CodeBlockNode child node types and the Instruction comments which were no longer being captured due to an earlier brainfart. Now all that's left to do is DRY up the Parser class - new ISyntax implementations can be added in about 10 minutes, if the regular syntax is simple (like, I'll implement OptionSyntax in no more than 5 minutes)
todo: traverse entire list of reserved keywords - make the parser recognize built-in functions
Excel 2010 has a fabulous feature under Data->"From Other Sources"->"From XML Data Import" to pull in XML from a web service, no coding required. Works great, but my service has now added a new column at the end. Refreshing the connection in Excel does not add the new column. In fact, creating a ...
Basically, don't rely on the registry entries as explained here on MSDN.
You need to create a Schema.ini file and put it in the same folder as all your text files. In the Schema.ini you specify the type for all columns you may have in your text files - it's just a much safer option to do that e...
I have been looking all over the place but I can't find anything about what a single standalone 0 do in a sample VBA code.
Sub Main()
If True Then
0
End If
End Sub
What does the 0 do in here?
What about this sample?
Sub Main()
If True Then
0
Else
0
End If
End Sub
...
yeah but people whos entire reputation is based off answering =SUM() and COUNTIF() type of questions aren't happy with that view. I can understand that but seriously, formulas should be tied to SU not SO.
Steps to reproduce
Open your EDA.xla file in Notepad++ and hit CTRL+F to search through the file.
Type in DPB as the search term.
Once the term is found replace the DPB with DPx
Save and close
Open the EDA.xla now. You should get a warning msg » hit YES
Open the VBE ALT+F11 or turn o...
Background
Kind of a follow up - slightly related to my other SO question.
I thought that if somehow I find a way in VBA to pass a single column to .NET and convert it to a native .NET type then I could finally overcome the mystery of explicitly looping on objects via COM (which is super slow a...
My code loops through cell values in a table and sees if document with same name exists.
If it does exist, it will perform an action to open those files and import data.
If bProcess Then
FileCounter = 0
For Each folderIDX In PrimaryMergeFiles
'If folderIDX.Name = Worksheets("Tabl...
I built a way to pick up comments and put them into a task list in vba. Because, ya know, COM I need to roll my own own configuration. This is what I came up with.
Alt+F11 in Excel > VBA; Alt+F11 in Word > VBA; Alt+F11 in Outlook > VBA; Alt+F11 in Access > VBA; Alt+F11 in PowerPoint > VBA; Alt+F11 in .. oh wait, doesn't work in OneNote :(
but you can write a COM add-in and load it into OneNote
@RubberDuck I don't think the comment has to start with the marker to be picked up. Well, ReSharper picks up a todo item anywhere in a comment I think.. .will test that tonight
> @@IDENTITY returns the last identity value generated for any table in the current session, across all scopes. You need to be careful here, since it's across scopes. You could get a value from a trigger, instead of your current statement.
Our consumer relations group gets survey results from customers after a claim is closed. They are plain text emails that look like this:
> Name: John Smith Email: [email protected] Client: SomeClient Contract Number: 123456 Service: Good Comment: I called in for a repair and received satisfactory service.
They manually take this information and input it into an Excel document with columns for each field. Is it possible to write a macro or something like that to automate it between Outlook and Excel, or something along those line?
if an incoming email has a subject that starts with "Survey result for ", then you try to parse the email's body into some object (a class module /DTO basically) - if it succeeds, you have your form, if not, you don't
this is string typed pretty bad, but your class would look something like this.
Private Type TSurveyResults
Name As String
Email As String
Client As String
Contract As Long
Service As String
Comment As String
End Type
Private this As TSurveyResults
Public Property Get Name() As String
Name = this.Name
End Property
Public Property Let Name(value As String)
this.Name = value
End Property
' etc
Getting a hook on an open instance of Excel is something I do all the time. I'm now questioning if I'm doing this the best way. I'm particularly concerned with the fact that I rely on the GetObject method to throw an error. I'd like to avoid it if possible.
I have a Utils module that contains a ...
Sub HelloWorldMessage()
Dim msg As Outlook.MailItem
Set msg = Application.CreateItem(olMailItem)
msg.Subject = "Hello World!"
msg.Body = "This is a test"
msg.Display
Set msg = Nothing
End Sub
What's the meaning of Dim? I'm not a fan of truncated keywords lol
In many compiled languages, calls to Debug.Assert, or their equivalent, are left out of the compiled production code for performance reasons. However, calls to Debug.Assert still appear to execute in the /runtime versions of MS Access applications.
To test this, I added the following to my star...
@Phrancis put On Error GoTo ErrHandler at the top, and Exit Sub after the Next instruction; then add a ErrHandler: label and say Stop and then Resume - when it blows up you'll be able to step through the code and the Resume instruction will bring you to the line that blew up
note: never put Stop and Resume into production code
and never put Resume all by itself (without Stop) - otherwise it'll just become an infinite loop
@Mat'sMug something like this? Getting syntax error
Sub ContactName()
Err GoTo ErrHandler
Dim ContactsFolder As Folder
Set ContactsFolder = Session.GetDefaultFolder(olFolderContacts)
MsgBox ("Contacts found: " & ContactsFolder.Items.Count)
Dim Contact As ContactItem
For Each Contact In ContactsFolder.Items
Debug.Print Contact.CompanyName
Next
Exit
ErrHandler: myError
Stop
Resume
End Sub
Actually seems to get hung up towards the end if I query other fields too... Hm.
Wait, question: Would Debug.Print display the record it is erroring on last before stopping, or would it display the one immediately before but not the bugged one?
Sub ContactName()
On Error GoTo ErrHandler
Dim ContactsFolder As Folder
Set ContactsFolder = Session.GetDefaultFolder(olFolderContacts)
MsgBox ("Contacts found: " & ContactsFolder.Items.Count)
Dim Contact As ContactItem
For Each Contact In ContactsFolder.Items
Debug.Print Contact.CompanyName
Next
Exit Sub
ErrHandler:
Debug.Print Err.Description
Stop
Resume
End Sub
Dim Contact As ContactItem
Dim Item As Variant
For Each Item In ContactsFolder.Items
Set Contact = Item
If Not Contact Is Nothing Then
Debug.Print Contact.CompanyName
End If
Next
Dim Contact As ContactItem
Dim Item As Object
For Each Item In ContactsFolder.Items
If Contact Is ContactItem Then
Set Contact = Item
Debug.Print Contact.CompanyName
End If
Next
it's because .Items contains more than just ContactItem objects I'd say
I was working from some tutorial on MSDN to learn to make some macros for Outlook. I have this subroutine that gets hung up with a Type mismatch error. Upon stepping through error handling after Stop and Resume it goes back to Next and finishes the query.
Looking through the result set in Immed...