« first day (291 days earlier)      last day (2889 days later) » 

12:00 AM
RELOAD!
 
How old are you guys' kids?
 
12:56 AM
turning 3 next month
freshly pressed:
Y U NO ONEBOX?
@StackExchange whenever you're ready dude
 
Lots of good stuff is coming up. See our 'News' section! https://rubberduckvba.wordpress.com/2015/03/24/rubberduck-1-3-when-the-vbe-becomes-a-real-ide/
 
1:45 AM
6 & 13 @Phrancis
> The result is the ability to make the difference between an array index assignment and a function call
@Mat'sMug... For cereal bro?! You're shitting me?
 
I'm not.
        private Declaration GetClosestScope(IEnumerable<Declaration> declarations)
        {
            // this method (as does the rest of Rubberduck) assumes the VBA code is compilable.

            var matches = declarations as IList<Declaration> ?? declarations.ToList();
            var currentScope = matches.FirstOrDefault(declaration => declaration.Scope == _currentScope);
            if (currentScope != null)
            {
                return currentScope;
            }

            var moduleScope = matches.FirstOrDefault(declaration => declaration.Scope == ModuleScope);
if there's an array in scope, the match will be the array.
if there's a function by the same name in scope, VBA itself will call it ambiguous.
@RubberDuck why didn't that ping me?
oh, triple dot
@RubberDuck the Code Explorer is broken again :(
the RubberduckParser class and its interface need to be simplified - they've been annoying me for too long.
 
2:21 AM
> Constant 'fizz' is never used
 
2:37 AM
Rubberduck x64版が動くようになったので、触ってみてるけど、「あ、これいいな。」感ある。 Rubberduck works fine under Win8.1 + Word2013. I like it. https://github.com/retailcoder/Rubberduck/releases #vba
@RubberDuck saw that? ^^
 
3:38 AM
> reimplemented Code Explorer. Ugly, but works.
 
no changes in functionality - nothing lost, nothing added. just... using declarations instead of the TreeViewListener.
and damn, that code is ugly.
 
> removed TreeViewListener class, moved TreeViewDisplayStyle to UI.CodeExplorer namespace
 
I like how everything is just slowly taking its place
 
4:39 AM
> fixed procedure scoping issue
[retailcoder/Rubberduck] retailcoder pushed 33 commits to next
2
 
^^ magic merge, no conflicts, nothing. went like butter in a frying pan.
oh crap
244 errors in 14 files
FML
same "corrupted files" issue
trying to exit VS & restart
 
> fixed broken using statement weirdness
 
phew
 
5:02 AM
TTGTB. I might start working on refactor/rename tomorrow. Or should I work on GoToAnything? Or FindAllReferences? #SoManyPossibilities...
 
Am I the only one crossing my fingers every time I merge 30-some commits from a dev branch into the next release branch? #github
 
 
4 hours later…
9:28 AM
@Mat'sMug Very cool. I hadn't seen that.
 
 
1 hour later…
10:33 AM
> In order to display "Unpublished" branches, we need to be able to get a list of remote branches too. The current API only returns local branches. LibGit2Sharp's API allows this, so it's a matter of modifying our internal interface to return Branch objects instead of strings. I'm not sure at this time the repercussions on the COM interface.
 
10:49 AM
> Added IBranchesView interface; implementation incomplete
> This needs to be completed before the BranchesView can be implemented. :top: priority.
> When creating the Branch class, I need to make sure the Name property is the default property for the class using [DispId(0)]. Any current COM clients have to declare this as a Variant type to iterate branches now. Doing this will mitigate the break.
 
11:56 AM
The COM SC API shall bend to the duck's will!
@RubberDuck I'll work on refactor/rename tonight. "GoTo Anything" and "Find all references" would make a nice introduction to the declarations API, you want them?
 
@Mat'sMug Sure. I can do it.
Do we have issues opened for them yet?
 
> 28 + 12 downloads
Yup!
 
Cool. I'll go ahead and assign myself. I want to get the branches view working first.
@Duga Sooner or later I'm going to make a breaking change...
It's good experience though. A nice thought puzzle of "How can I change this without breaking the interface?"
 
Looks like it! :)
 
12:04 PM
@RubberDuck Heck, you might as well get all tabs done and push to Next before that :)
 
@Mat'sMug Sounds like a plan... ish. The Unsynced commits will be a challenge.
I can't find the other issue.
 
After rename, I want to see how possible a "change signature" refactoring is possible
Ah, GoToAnything appeared in my head as I was writing the blog entry - you're right there's no issue for it
It's basically R#'s Ctrl+T :)
@RubberDuck Isn't there a local commits API in L2S?
 
@Mat'sMug Yeah. There is, but it's not exposed through the ISCProvider.
Yet.
I didn't think about it when I defined it.
 
12:55 PM
> Breaking Change. Noun. A change that's made for the Greater Good.
;)
 
1:06 PM
> Let's create a little window that allows the user to type in any identifier name and navigate to it. There should be a dynamic dropdown for easier selection, and the displayed text should include the name of the module each identifier is declared in. For example, typing "do" could bring up... - "DoSomething (in Module1)" - "DoesThisWork (in TestModule3)" - "Directions.Down (in Navigation)" ...items should be sorted alphabetically, and ideally have an icon representing their declaration...
 
We need a "navigation" label
 
type (method, enum, const, event, etc.) - this might not be easily done wih 100% WinForms code though.
 
2:06 PM
> Duplicate of #333
> Navigation is starting to become a major aspect of Rubberduck's features with v1.3 - let's add a navigation commandbar. I can think of a few useful buttons to put there:

- [ ] Toggle *Code Explorer*
- [ ] GoTo Anything #340
- [ ] Regex Search & Replace #327
- [ ] Find all references #333
- [ ] Find all implementations #334
> Repro: - Open up Excel, create 2 workbooks - Bring up the VBE - Rename VBA projects to Project1 and Project2 - Double-click on Thisworkbook under Project1 in the IDE's Project Explorer - Bring up Rubberduck's Code Explorer - Select ThisWorkbook under Project2 in the Code Explorer - Add a component to the project from the context menu or toolbar in the Code Explorer - The new component gets added to Project1 because that's the active project as far as the IDE is...
concerned.
 
2:21 PM
@Duga I noticed that. Not sure how we're gonna make that happen.
 
@RubberDuck Set Application.VBE.ActiveVBProject = Application.VBE.VBProjects("System")
works from the immediate window
 
You can do that?
 
apparently!
so we can even set the active VBComponent :)
 
I would have figured it was a read-only property.
 
me too!
I thought "heck, if we don't try it....."
 
2:25 PM
Well, that's gonna make SCI a bit easier.
I was actually a bit worried about that.
 
> ActiveVBProject and ActiveVBComponent can be programmatically assigned. This should be an easy fix.
 
I bet ActiveWindow can also be assigned that way
 
Yo
 
Yeah
 
2:46 PM
Show this answer some love? I found it interesting, albeit somewhat longer than the FGITW answer
I find myself very often moving handled emails in the same two folders in Outlook; guessing it would be fairly simple matter to write a macro for that?
 
3:01 PM
@Phrancis Done and done. It is a good answer.
To his point though, use vbNewLine in VBA.
Semantically similar to the Environment.NewLine he mentioned.
 
So if I changed TextLine = TextLine & vbCrLf & FSO.opentextfile(Path & FileExt).readall to use vbNewLine instead should work identically?
 
Yes. Only it will work that way on any OS.
So, no. It doesn't work identically, but it works better than that.
 
OK
Was working using examples on forums, not always the most trustworthy source
Probably would be smarter to RTFM
 
3:41 PM
I'm finding this other macro I've been working on surprisingly difficult to get to work :|
Got a bunch of .txt files in a folder. I'm trying to read each file, line-by-line, and combine all the text in an output .txt file... Would it be smarter to try to use an Excel worksheet to copy the file names first, and then use that list of files for input path?
 
I'd just use a collection of strings.
 
Got anything I can read on the topic? I've been trying to use an array (I think?) but it's just not wanting to work
@RubberDuck Like this?
(I googled for collection but it came back with arrays... basically same thing?)
 
Or loop through the dir
<meeting>
 
OK
 
4:26 PM
Yes @Phrancis. Like that, only you might want to skip the array and just Dir$ your way through, depending on your use case.
 
OK. Can this be done in a simple Sub or would I need a Function?
 
4:40 PM
Idk. What are you trying to do?
Append each file to one "centralized" one?
 
4:51 PM
Yep, take a whole bunch of flat data files containing historical data all formatted the same so I can import them into an Access database
It's ad-hoc so I did not think writing a Function just to use it once would make much sense
 
We strongly recommend to use Option Explicit at the start of your #Excel VBA code: http://www.excel-easy.com/vba/examples/option-explicit.html http://t.co/XGmMI9zohM
 
^^ had to RT :)
 
@Mat'sMug ^^ The shit I have to put up with. GROAN
 
@Phrancis Lol, what's that?
 
Email from a vendor (in French of course)
 
5:04 PM
Looks like either a pissed/confused coworker or customer?
 
@Phrancis wow that's only a few KM's from here!
 
Yep, you've probably seen their trucks around, they're a pretty big establishment. They're on Boul. St-Laurent.
 
Why is it in full caps?
 
Because her email etiquette is horrible
 
I'd be ashamed if a worker of mine would send such mails
 
5:10 PM
She's been doing things wrong for years, and our underwriters finally had enough and sent her a fax to let her know, either you start doing it right, or we're not paying it.
And so she's fussing because "IT'S NEVER BEEN A PROBLEM BEFORE WHY DO I HAVE TO DO IT DIFFERENTLY NOW???"
I've been purposefully ignoring her emails for a few hours before I respond, is that justified?
 
@Phrancis Yes. If it was absolutely urgent she would call.
No one should ever expect an immediate response via email.
 
@Phrancis Of course
 
@Phrancis 47.5 hours would be justified in that case!
2
 
Yeah I've let the original complaint sit over the weekend ;-)
 
Anybody want it? I've had enough bad code for a day.
1
Q: Update on Weave Merging n lists into single list

ForrestAThis is a follow up to my previous post from 7 months ago. I changed up the algorithm a little. Instead of inserting items into a new list, each item's final place is calculated up front. Sort of like if instead of resizing an array each time I add a new item, I'm sizing it up front and just sett...

 
5:19 PM
Isn't the standard for VBA variable names to use PascalCase?
 
2
Q: Update on Weave Merging n lists into single list

ForrestAThis is a follow up to my previous post from 7 months ago. I changed up the algorithm a little. Instead of inserting items into a new list, each item's final place is calculated up front. Sort of like if instead of resizing an array each time I add a new item, I'm sizing it up front and just sett...

 
' opening operations
songCount = sourceWs.Range("A1").End(xlDown).row - 1    ' total songs in destination sheet
totalsWs.PivotTables("SongCount").ChangePivotCache _
    wb.PivotCaches.Create(SourceType:=xlDatabase _
                        , SourceData:="Source!A1:C" & songCount + 1)   ' set pivot data source range
totalsWs.PivotTables("SongCount").RefreshTable    ' refresh pivot table
pivotRows = totalsWs.Range("B1").End(xlDown).row    ' total rows in pivot table
destinationWs.Cells.Delete    ' clear destination sheet
' ORLY? YA RLY.
 
> No way rename isn't shipping in 1.3!
3
 
@Phrancis camelCase, but the IDE fights you every step of the way. It oh so helpfully "corrects" your capitalization for you...
Case insensitive langauges are a PITA
 
Do you mean that in VBA... FooBar, fooBar, foobar & FOOBAR are the same object/reference?
<lunch>
 
5:58 PM
@Phrancis I mean that if there are two identifiers with the same name, the IDE will recase them for you.
    Pubilc Sub Foo
        Dim bar as Integer
    End Sub

    Public Sub Baz
        Dim BAR as String
    End Sub
Up there ^ bar is two separate references, but the IDE will force them to be the same case.
 
Oh, that's gotta be freaking annoying.
Does Rubberduck help with fixing this "feature" in the VBE?
 
6:29 PM
It can't unfortunately.
At least I don't think it can.
Ugh... some one please make the meetings stop today.
 
nope. that's not possible
the only solution is ...consistency in naming :)
 
 
1 hour later…
7:58 PM
I think I'm making progress but not sure what to do about this error...
Sub Combine_Text_Files2()

    Dim FileArray() As Variant
    Dim FileName As String

    FileName = Dir$("C:\text\*.txt")

    Dim i As Integer
    i = 0
    Do Until FileName = ""
        i = i + 1
        ReDim Preserve FileArray(1 To i)
        FileArray(i) = FileName
        FileName = Dir$
    Loop

    For i = 0 To UBound(FileArray) ' HERE: SUBSCRIPT OUT OF RANGE AFTER THIS LINE
        Debug.Print FileArray(i)
        Next i

End Sub
Any quick fix or should I hit SO?
 
don't hit SO with that
try looping from LBound(FileArray) To UBound(FileArray)
hint:
> ReDim Preserve FileArray(1 To i)
 
So... i = 0 doesn't actually exist, I feel dumb now lol
 
@Phrancis see it yet?
ah
lol
3 mins ago, by Mat's Mug
don't hit SO with that
 
Well, still not working after making a few changes
For Index = LBound(FileArray) To UBound(FileArray)
    Debug.Print FileArray(Index)
    Next Index
Same error same place :D
 
Dim FileArray() As String
and then redim 0 to i
and change your Do Until FileName = "" to start populating at index 0 and loop until FileName = vbNullString
damn, and arrays suck, why not just use a Collection?
 
8:23 PM
5 hours ago, by Phrancis
(I googled for collection but it came back with arrays... basically same thing?)
 
Dim files As New Collection
files.Add "hello.txt"
For Each f In files
` Debug.Print f`
Next
 
Shit that's way simpler
3
 
uh-huh
 
UGH
Stupid typo
FileName = Dir$("C:\text\*.txt")
The directory is called "test" not "text" -_-
 
lol
 
8:31 PM
Fixed that and boom it worked. Still gonna try with a collection though
And, no output no error, evidently something is wrong again
Meh, it works, I'll finish writing it to actually read the files and do what I want with them and post it for review (along with a couple other related Subs)
 
9:17 PM
 
woot!! 30th star!!
3
 
9:32 PM
Ugh almost working, except for some reason FSO says "File not found" when I run... Even though the file name is right there in the array I just made that I'm pulling from...?
 
9:43 PM
@Phrancis Welcome to VBA
2
 
9:55 PM
WTF
Dim FSO As Object
Set FSO = CreateObject("scripting.filesystemobject")

If FSO.FileExists(OutputDirPath & OutputFileName) Then
    FSO.DeleteFile (OutputDirPath & OutputFileName)

Dim Stream As TextStream ' User-defined type not defined??
Set Stream = FSO.CreateTextFile(OutputDirPath & OutputFileName, True)
 
Dim Stream As Object
you're late-bound here
 
O.
Damn, another day goes by and this thing still doesn't work.
I'll just drop this here. It errored on the 2nd iteration (as you can see per stdout) right before doing the 2nd Debug.Print... Output text file is blank. D:
TTQW, I'll keep trying tomorrow
 
later!
 
10:31 PM
There's got to be a smarter way to copy file content into another file than one line at a time
Maybe this? But it doesn't use FSO or TS ...? VBA is weird.
 

« first day (291 days earlier)      last day (2889 days later) »