This code works fine with VBE window open, but raises an error Subscript out of range at this line: wB.VBProject.VBComponents(wS.CodeName).Properties("_CodeName").Value = "wsData"
when VBE window is closed. Maybe someone can show me what I'm missing here.
Sub newWorkbook()
Dim wB As Workbo...
I think renaming a worksheet "just works" the way we have it now. You'll have to hard-code ThisWorkbook somewhere. And I wouldn't assume all versions of office have that property at index 13
it's used for renaming any Declaration that has a DeclarationType of DeclarationType.Module and possibly DeclarationType.Class, so that includes standard modules (.bas), and (if .Class is also involved) class modules (.cls) and user forms (.frm), ...and RD Declarations treat ThisWorkbook and worksheets as classes, too (which they are).
if you can write one. you see writing unit tests for the RenamePresenter was done (thanks to @PetLahev), but I had to comment everything out when I introduced the TokenStreamRewriter dependency.
tip: if you refer to an issue (like "#358") in a commit comment, the issue will link to the commit
the "#" makes the difference ;)
I don't think it gets any clearer than that:
// identifiers used inside selection and before selection are candidates for parameters:
var input = inScopeDeclarations.Where(item =>
usedInSelection.Contains(item) && usedBeforeSelection.Contains(item)).ToList();
// identifiers used inside selection and after selection are candidates for return values:
var output = inScopeDeclarations.Where(item =>
usedInSelection.Contains(item) && usedAfterSelection.Contains(item)).ToList();
if you need help with the UI, let me know; I want all dialogs to be consistent throughout the application, so feel free to look at the other dialogs in the UI namespace
basically if all usages are in the same scope, no need for a UI; if there's only the declaration to rename, no need for a UI; otherwise, yeah it's a treeview, with checkboxes so user can pick which references to rename or not
Public Sub Foo(ByVal Var1 As Integer, _
ByVal Var2 As Integer)
Method1 Var1, Var2
End Sub
Private Sub Method1(ByVal Var1 As Integer, ByVal Var2 As Integer)
Debug.Print Var1
Debug.Print Var2
End Sub
// identifiers used inside selection /*and before selection*/ are candidates for parameters:
var input = inScopeDeclarations.Where(item =>
_usedInSelection.Contains(item) /*&& _usedBeforeSelection.Contains(item)*/).ToList();
Private Function Method1(ByVal fizz As Integer, ByVal buzz As Integer, ByVal value As Integer) As String
Const fizz As Integer = 3
Const buzz As Integer = 5
If value Mod (fizz * buzz) = 0 Then
result = "FIZZBUZZ"
ElseIf value Mod fizz = 0 Then
result = "FIZZ"
ElseIf value Mod buzz = 0 Then
result = "BUZZ"
Else
result = value
End If
Method1 = result
End Function
Public Sub FizzBuzz()
Const fizz As Integer = 3
Const buzz As Integer = 5
Dim result As String
Dim value As Integer
For value = 1 To 100
result = Method1(fizz, buzz, value)
Debug.Print result
Next
End Sub
@Hosch250 that's how a function returns its value in VBA
oh, and about the empty Refactorings folder... fine, remove it. but I really hope it comes back eventually; I don't like having all the refactoring logic in presenters - at one point I want refactorings to implement some IRefactoring interface, with a void Refactor(Selection) method so that code inspection quickfixes can call them.
It was supposed to be OS concepts, but we were being quizzed on whether Python supported multi-threading without ever discussing/reading about Python...
> Closing for now, d819d77 addresses this - I've tested it with a number of test cases, but I'm still not very confident about it (see github.com/retailcoder/Rubberduck/commit/…).
This post is somewhat of a follow-up to Rubberduck's "Extract Method" refactoring implementation.
A tremendous amount of things have changed since version 1.2, when this that feature was first introduced - the more important thing being the advent of the Declarations API, which implies that the ...
I have a sheet where a macro duplicates the sheet and then inputs the days of the month and year across the top. The template sheet has 31 pre-formatted columns which get the dates filled into them. I am trying to delete the columns that come after the last day of the month because not all mont...
I have a workbook that I have already programmed to duplicate, autopopulate the top row with dates based on month and year input. Each month has a different number of days. I have formatted 31 columns in the template. When the days of the month fill in at the top of the sheet, I want to be abl...
@StackExchange I helped this guy fix this issue 2 or 3 days ago, then sent him to CR to get his ugly macro recorder code cleaned up. I guess he broke it then came back to CR to get it fixed.
So, I have MOSTLY solved the problem of deleting the excess columns. I use a range and delete entire columns. The code looks something like this:
Populate DailySales, DailySales.Range("B6"), DailySales.Range(DailySales_
.Cells(6,2),DailySales.Cells(6,2+Days))
Range(Cells(1, 3+Days), Cells(1, ...
I asked a question on stackexchange and was given an answer by multiple people that checking for errors in-line was not a good practice. I have been using an on error resume next do something on error goto 0 block structure for years as kind of a ghetto "try-catch" structure in VBA.
Here is a...
My question is whether or not this is a good practice, and/or if there is a more efficient way to do it.
I have to access this Solidworks interop object and wait for it to return some value. The return is a string. In early testing I found I ran into issues if I didn't wait for the return, so...