« first day (2077 days earlier)      last day (1103 days later) » 
00:00 - 19:0019:00 - 00:00

7:00 PM
Sheets("Test List") is unqualified, does it mean to work off whatever the ActiveWorkbook is?
 
yes
oh, should be thisworkbook, as multiple of these files could exist
gg
damn you for making me think about these things to improve my coding
 
consider giving that sheet a code name then
wrong active workbook -> that's error 9 here
 
Set testListSheet = ThisWorkbook.Sheets("Test List"), now... multiple workbooks using this template can exist, which may have different coutns of tests/etc. in the Test List, so needs to be specific to the workbook containing the function
 
or, you take the ranges as parameters, and free the UDF of any particular sheet name & column layout expectations
 
not sure i'm following that statement
 
7:05 PM
(although, it should explicitly assert that testNameRange, setupHourRange, and sampleHourRange are all the same size)
 
i should most likely find last row than using the entire column, considering 300 versus 1M is quite the wasted space
 
I like a UDF that takes all its parameters as arguments
 
ugh.
I've found my Excel issue by reloading my modules 1 by 1.
 
basically, figuring out where the ranges are isn't its job :)
@FreeMan what was it?
 
It's in my SourceControl.bas, but I haven't a clue what the issue is with it.
As I was going through them, I had a feeling that SC.bas was the issue, so I saved a bkukp copy of the xlsm before adding it in.
as soon as I added it, I saved and got the "cannot reopen" error.
Thing is, I know I've used this module before and not had issues with it.
gotta a sec to give it a quick CR here to see if you see anything obvious?
 
7:18 PM
@MathieuGuindon i hear you
 
if i overload MethodName in a class I export to com while applying DefaultMember("MethodName") what happens?
 
you get MethodName and MethodName_2
 
Attribute VB_Name = "SourceControl"
'@Folder("Utilities.Tools")
Option Explicit

Public Sub SourceExport()
  ExportSourceFiles "H:\git\SatisfactionSurvey"
End Sub

Public Sub SourceImport()
  ImportSourceFiles "H:\git\SatisfactionSurvey"
End Sub

Private Sub ExportSourceFiles(ByVal destPath As String)

  Dim localPath As String
  If Right$(destPath, 1) <> "\" Then
    localPath = destPath & "\"
  Else
    localPath = destPath
  End If

  Dim component As VBComponent
  For Each component In Application.VBE.ActiveVBProject.VBComponents
 
i thought i had a nice workaround
for COM not reading indexer as default member by default
 
7:27 PM
Other than the fact that I don't use RemoveAModule, I'm not seeing any obvious issues.
 
int this[int index] shows up as Item in vbe object browser and requires class.Item() to invoke instead of class() :/
is there something else I can do with that
 
this is part of the problem. This is the bloody VBA language reference page and the code samples are in VB!
 
VBA language reference is so bad
isnt that legal VBA syntax too tho
@FreeMan i would recommend a nice cntl+c in old module -> cntl+v in notepad -> add new module in VBE -> cntl+c in notepad -> cntl+v in new module
that would at least isolate code issue from module file corruption issue
 
Yeah. just effectively tried that.
I added a brand new .bas module, pasted in all the code above and saved. Boom.
"bad" boom, not bazinga "boom"
 
"big boom, bada-boom"
 
7:40 PM
What's the '@Attribute incantation to set Attribute VB_Name = "SourceControl"
I don't see it described here
 
there's no annotation for that...
it's just the module name
 
oh.
 
would be redundant?
 
that comes from naming the module when saved?
 
huh, no, it comes from the ITypeInfo that's describing your VBA project component
 
7:43 PM
uhhh... say again?
 
your module is in your VBA project
therefore it has a name
when the VBIDE exports that module, I'd expect it to have a VB_Name attribute with that name
what's this code doing that you can't do with Rubberduck though?
 
got it.
@MathieuGuindon this was written before I realized the duck had the import/export.
 
ok but now that you know it's one click away, why debug it instead of just... burning it with fire?
 
what's the difference?
@MathieuGuindon reasonable, and I'm happy to do so. Confusing why the heck it suddenly doesn't seem to want to work.
 
> Update Components from Files will update existing modules from files in a selected folder, and Replace Contents from Files will make the VBA project mirror the contents of the selected folder (creating new project components/modules as needed). Because Visual Basic 6.0 already works off the file system, in VB6 we only offer the Update Components from Files command.
 
7:52 PM
yeah, reading that, thanks.
 
@FreeMan I'm thinking this menu needs a better icon. the 2-way arrows are confusing, the two commands both import things
"Sync Project from Files..." -> Update existing components / Replace project contents
 
So Replace contents will remove all modules from the project then import everything from the pointed to directory, while Update Components will overlay all modules in the project with the code in the directory, but will also leave any modules that aren't in the directory. right? Will it create new modules that are in the directory, but not in the project?
 
yes, but not if they're .doccls
(only the host app can create document modules)
 
sounds good.
Guess I'll junk my SourceControl. Imma guess this will work better in the long run anyway.
 
'@Folder("ObsoleteJunk")
:)
 
7:57 PM
yeah. NO! It corrupts the XLSM file if the code even exists!
 
hm?
working off a saved host workbook, right?
 
@MathieuGuindon maybe leave the 2-way arrows and the Sync Project text, but add the Rubberduck | Tools | Export Active Project... menu item to the context menu in the CE
 
it's ...literally 2 buttons under the sync command
oh wait, the command depends on the selected node
i.e. you need to right-click the project node
 
@MathieuGuindon Yup. This has been today's Excel drama, brought to you Excedrin
 
if you right-click a module you get the export command to export that module
 
7:59 PM
^ ah...
 
if you right-click the project you get the export comand to export everything
 
yeah, hadn't thought of that. It would still make sense (to me at least) if all 3 options lived under a Sync Project submenu available on any right-click. I get the whole project with the VBAProject level click, but... #EnableMyLazy
 
ah, yes. and then the double arrows would make a lot of sense
 
now you're coming 'round to my side of the cliff!
#NotSureIfThatsGoodOrBad
 
that's a low-hanging fruit of a PR BTW
wink wink, nudge nudge
 
8:03 PM
I can't figure out my own code and you're trusting me with yours?
 
that was quick
 
@MathieuGuindon yours, as in not mine.
Yeah, I know. It'll have 37 eyeballs looking at it before it goes anywhere...
19 people. I expect 1 of 'em to squint at it all funny like
 
was gonna say - who's got the glass eye?
Or the patch maybe... guess a glass eye is still technically an eyeball
 
@FreeMan did you paste it directly from the old module to the new one? the notepad part is necessary.
@MathieuGuindon is there a workaround for an indexer not appearing as default member when exported to COM?
 
8:15 PM
good question... why would it be a default member by default?
 
@theVBE-it'srightforme added a new .bas module, copied the code from Notepad++, pasted into the new module
 
or are you marking it as a default member?
 
@FreeMan does it still cause an issue when its the only module in a new workbook?
@MathieuGuindon from what I read of the C# reference the indexer becomes default member automatically?
so i did not use the attribute on the class declaration
oh right
and because VS told me I can't use DefaultMember() on a type containing an indexer
 
@theVBE-it'srightforme haven't tried that.
 
I'd avoid anything implicit with COM interop
 
8:18 PM
@FreeMan try that and try using regular notepad instead of ++
 
giving it up for now, at least. RD's built in import/export are working fine, and I've got reports to get out the door.
 
@MathieuGuindon i am quickly learning this principle :/
however I don't know how to make an indexer explicitly
or make the indexer marked as default explicitly at least
oh wow that is so stupid
i didnt think the number you put in DispId mattered
at all
of course it does
@MathieuGuindon so DispId = VB_MemberId?
 
Renaming a module w/RD. Name is "ModuleName" trying to rename it "Modulename". RD shows the red X disallowing the change (Excel VBA). Is that by design?
 
VBA is case insensitive so you are trying to name it the same thing
or do you mean not letting someone change the appearance of the same module name in that feature?
 
8:34 PM
@theVBE-it'srightforme I think DispID is closer to VB_UserMemId, but, ...not sure.
@SmileyFtW yes, it's the same name. If you want to "fix" the casing, type Dim ModuleName somewhere, hit ENTER, then delete that line.
actually, that probably won't fix the module's name
edit it in the properties toolwindow
 
@FreeMan Probably. But my question would be, "who else has my private key?"
 
@mansellan hence the "not much confidence" ;)
 
Or maybe it's end-to-end encrypted with ROT13 :-)
 
twice, to be sure
 
@this Sure, it's ABC: Always Be Compiling :-)
@MathieuGuindon To be super-sure, the second run is rotated in the opposite direction.
 
8:57 PM
now that is something I've never seen before. brace yourselves...
' Helpers {

function LOBYTE(dw as long) as byte ' {
    LOBYTE = dw and &h000000ff
end function ' }

function LOWORD(dw as long) as long ' {
    if dw And &H8000& then
        LOWORD = &H8000 Or (dw And &H7FFF&)
    else
        LOWORD = dw And &HFFFF&
    end if
end function ' }

function HIWORD(dw as long) as long ' {

    if dw and &H80000000 then
       HIWORD = (dw \ 65535) - 1
    else
       HIWORD = dw \ 65535
    end if

end function ' }

' }
the things people do to help improve "readability" ... commented-out braces ffs...
 
oh boy
 
at least they didn't put them on if ... ' {
sad that it's not '#region Helpers and '#endregion
 
-1
Q: VBA to retrieve/display information of cells in excel

MaxI am working as a validation technician for excel spreadsheets in a pharma company. Sadly & interestingly I don't know much about VBA and Excel. To validate those excel spreadsheet, I developped with macro-recording the following code, which helps me identifying the cell properties. The goal is...

 
Uh... is that VBA with comment braces trying to act like C#?
W
O
W
 
@MathieuGuindon well it certainly is treated the same way when you COM interop because setting [DispId(0)]` on the indexer and reexporting magically made the object browser recognize it as the default member
 
9:01 PM
adds braces... Yay man, I know C#!
 
and we all know what number you set VB_MemberId to
 
@IvenBach also known as C--
 
Lol.
 
@MathieuGuindon that is the l33tspeak equivalent for VBA
 
all I see is implicit Public and ByRef modifiers.. everywhere
 
9:04 PM
i was just cringing at the terrible style
 
i thought it was considered bad practice
oh implicit public modifier is considered bad style lol
anyways if you are setting an enumerator on a class you use memberID 4 right?
im going to have to assume the same will apply for that as it did for the default member
 
@theVBE-it'srightforme yes and IIRC there's a VB_MemberFlags value that needs to be set as well
wait a minute
 
@MathieuGuindon oh man im excited to find the C# equivalent for that!
ok waiting
 
nevermind, RD isn't setting the member flags
I can't remember it, but it makes the member hidden in VB6 (VBA doesn't honor it)
 
9:11 PM
oh so it wont show up in object browser unless "display hidden members"
how important is hiding the enumerator like that
 
actually, prefixing the member with an underscore should "just work" and do the same
@theVBE-it'srightforme it's just a nice thing to do: that member isn't meant to be invoked directly from user code :)
 
@MathieuGuindon recalls your quote from earlier about doing things implicitly in com interop
okay ill try to make sure its there
think im unstuck for now, gonna get food and try to get things functional
ty for the help as always
 
@theVBE-it'srightforme haha ..yeah. I think @this would know what the actual explicit incantations are
yw
OTOH, _Extension.cs in RD does have a prefixing underscore, so..
[
    ComVisible(true),
    Guid(RubberduckGuid.ExtensionGuid),
    ProgId(RubberduckProgId.ExtensionProgId),
    ClassInterface(ClassInterfaceType.None),
    ComDefaultInterface(typeof(IDTExtensibility2)),
    EditorBrowsable(EditorBrowsableState.Never)
]
// ReSharper disable once InconsistentNaming // note: underscore prefix hides class from COM API
public class _Extension : IDTExtensibility2
 
9:30 PM
@MathieuGuindon What I did was make a "material change" (took the last letter off and made the case change); then made another change to put the last letterback. It's a holdover from previous (possibly bad) habit of letting Option Explicit catch mispellings. Sometimes I want a different camelCasing... no biggie.
 
no no no, letting Option Explicit catch typos is exactly what you need it for
 
10:11 PM
UGH
Side note, asking for off-site resources is explicitly off-topic here. See How to Ask and help centerMathieu Guindon 27 secs ago
I've cast an accidental close vote
Jan 30 at 17:48, by Mathieu Guindon
@TimWilliams fine, I've put in the 3rd reopen vote. Question strikes me as something that can only be answered with an ever-growing list of Excel features, but eh whatever, I've cast my last vote-to-close on this site. — Mathieu Guindon 57 secs ago
 
10:49 PM
 
11:02 PM
lol
 
11:41 PM
this is purely curiosity - can anyone explain why:
constrIL.Emit(OpCodes.Ldarg_0);
constrIL.Emit(OpCodes.Call, baseConstr);
constrIL.Emit(OpCodes.Ret);
does not appear in dotPeek unless the last line is commented out
sorry to clarify i mean the method the IL generator is associated with
 
11:56 PM
afaict it gets optimized out because there are no observable sideeffects for the caller
like ...
base(args[0]);
// return;
^ this doesn't do much, depending on what baseConstr points to
the runtime's JIT compiler can be frighteningly smart sometimes
 
00:00 - 19:0019:00 - 00:00

« first day (2077 days earlier)      last day (1103 days later) »