Look, either you keep stubbornly digging yourself into that doomed rabbit hole that leads directly into a wall, or you clarify the why so people can help you come up with an actual viable, not-clunky solution that actually works. But I'm done here, good luck disabling the VBE. — Mathieu Guindon39 secs ago
I am familiar with obtaining the System Username. How do you return the
System Password ? The login password for Windows on a machine ?
Is it possible ?
Thanks
basically it's like asking some C# question, getting a comment from Jon Skeet or Eric Lippert saying you should probably do XYZ instead, and then :shrug:
@theVBE-it'srightforme you can put it in the postbuild events; RD had it that way for a long time
@theVBE-it'srightforme because.... complex build process, antlr grammar, COM registrations, ...and then there was that one time I ended up needing to wipe over 200 registered versions of RD from my registry because prebuild wasn't unregistering the previous build...
there was that one time I ended up needing to wipe over 200 registered versions of RD from my registry because prebuild wasn't unregistering the previous build...
@theVBE-it'srightforme nah just one of many hopeless vampires that don't care to learn anything and just want ready-made solutions chewed up and given to them
@theVBE-it'srightforme actually the build process doesn't involve regasm.exe; IIUC we're writing to the registry ourselves, to make e.g. unit testing work with a per-user install
@MathieuGuindon TBH, I find E & C flaky in C#.... More often than not, I get "you can't edit because stack frame will be unwound, and bad things will happen, so Dave, I can't do that, sorry."
@MathieuGuindon @theVBE-it'srightforme Yep - VS's default COM interop is boneheaded because it insists on writing to HKLM by default and you can't change that. As Mat correctly notes, we generate our own registry keys at build-time so that we can write to HKCU.
Friendly reminder: Read this wiki. Read the links linked there. Do it few times until you got it. Ain't no magic about COM, I promise!
@MathieuGuindon Just as a FYI - the underscore will make it hidden but won't actually prevent the use thereof. To actually do so, one needs the restricted, something which .NET has conveniently not provided a interop attribute for and therefore we must inject it ourselves.
> I agree with this as of the latest prebuild as well. However, setting the option to remove seems to apply for a while, then under some circumstance that I cannot reproduce, the indenter acts like it is set back to 'ignore' and i have to go back into the settings and change it back to 'remove'.
my code in MS project VBA, in theory, doesn't do anything major. Compares the tasks with each other. But it runs super slow. One run through Temp lasts 15 secs. Try that with 1500-2000 tasks and the macro takes hours.. Please advise.
Sub Laczona()
Application.Calculation = xlManual
Application...
@QuackExchange Interesting that the suggestions focus on fixing the loops; nobody thought to look at the object model to find if there's a method that would do the job.
Because Dim Temp, Temp2 as Integer, Temp is an implicit Variant. Both of them should be Long. Dim Temp as Long, Temp2 as Long. Even better, declare them on separate lines - vertical space is cheap and eliminates that confusion. 64-bit Office will implicitly convert Integer to Long anyway, so no sense declaring it as Integer. — FreeMan43 mins ago
^ @FreeMan something something answers in comments
@this I don't think it's particularly easy to rewrite this as a Filter, actually..
at least the docs about Filters are pretty bad there :/
say you have a procedure that needs to receive an undetermined amount of value pairs. in C# you'd probably just take in a params Tuple[] and call it a day. what do you do in VBA?
I have two subs and want to pass values from one to the other.
Option Explicit
Sub Test()
Call HandleInput(ActiveSheet.Range("A1:C4"), 4, 2)
End Sub
Sub HandleInput(rng As Range, rowNumber As Long, colNumber As Long)
Debug.Print rng.Cells(rowNumber, colNumber).Value
End Sub
However,...
@MathieuGuindon I've felt the same way - if we try to apply good OOP, it ends up with more boilerplate simply because VBA won't do it for us under the hood.
Whereas C# is magical in contrast. I don't think many people who work with C# (and not with any low level languages) even realize how much magic there is going on in the compiler
@MathieuGuindon share code with other VBA experts. See them scream bloody hell for not using reddick & using classes when you could just do it with modules.
speaking of which.... I should finish that article about class modules...
One more point to think about, though - VBA is inherently event-driven, right?
So if you can just add a event handler, and then just write code... wow! How easy!
So more often than not, they are extending some existing classes (usually the document class). It's when they need to do it in a generic manner that they get in trouble. (e.g. smart UI)
I create a new branch and I dive in and start working on what's already in the .accdb and forget to import the code from whatever branch I just checked out
:(
potentially dumb question, @this - how will import/export differ between OASIS and RD's import/export?
dumb... OASIS divides up the reports & forms into 2 parts, I'd imagine that RD does not.
I have to remove the header to get it to compile. I've never typed it in by hand.
oohh... I wonder if somehow, that was there from way back when I did my own export and those have never been overwritten properly by an OASIS export...
Now I've got a record source for a drop down and it's telling me that my record source (specified as a query in code - working for the past year+) doesn't exist and that I should select an existing table or query.
I've got SELECT ... FROM ... WHERE... in the record source.
the query is valid, I can execute it in SSMS with no issue.
A code smell is a symptom which indicates that there is a problem in the design which will potentially increase the number of bugs: this is not the case for regions, but regions can contribute creating code smells, like long methods.
Since:
An anti-pattern (or antipattern) is a pattern used ...
@this I've exported everything from my Access project via OASIS. The only odd thing I'm seeing so far is that my form.def file starts with CodeBehindForm. My .layout files do not have code in them, only the layout info.
@this because it was duplicating code in the .layout file before. So it's odd in that which appeared to be borken before is working fine now. I also just did a test import of a form and a class module that were giving me import errors before and they seem to have imported correctly now.