I'm new here but excited to find the community. I'm new to macros, so forgive me if this seems rudimentary but I haven't been able to find an answer in any of the forums yet.
I recorded a macro in Excel 2010 using the following vlookup function:
ActiveCell.FormulaR1C1 = _
"=VLOOKUP([#[Campaign Id]],'BAM Raw Data'!C[-5]:C[-4],2,0)"
I'm new to the code side, so I don't quite understand how or why this works as the original vlookup was =VLOOKUP([#[Campaign Id]],'BAM Raw Data'!F:G,2,0), but regardless in 2010 the macro works beautifully.
I sent this macro to my team who are all running Excel 2007 and so far it seems that I continue to get a runtime error 1004 when I run it. When I go to debug the error, it points me to this vlookup function.
Is there a particular way to code a vlookup in VBA in 2007 vs. 2010 that I'm overlooking?
Excel 2007 structured reference syntax is different from Excel 2010 structured reference syntax. The # sign is not interpreted in 2007.
Change the formula to use normal references, which will work in both versions of Excel.
Related
I have a old VB 6.0 application written by someone else. When i compile the application, it throws error on every line of code where VBA reference is required so fro e.g. it throws an error in the following lines:
Left$, Chr, Trim$
As soon as I prefix it with VBA.Left$, the error goes away. I was looking at the list of project References and saw only one missing reference called "Microsoft DTS run time 1.0". Where can I get this reference from and how can I add this in VB application. Also, is there any way, I can add VBA reference to VB application. I am running this VB application on XP machine.
any help will be appreciated.
Then you should install Microsoft DTS runtime:
How to: Install Support for Data Transformation Services Packages:
https://technet.microsoft.com/en-us/library/ms143755(v=sql.105).aspx
After, add the VBA reference (if is missing)
If you look at your list of Available References, you should see one for Visual Basic For Applications. Make sure this is checked and you will be good to go.
If there is more than one reference for VBA, select the one for msvbvm60.dll.
Porting legacy PB code to the .NET era might require major refactoring, to get the work done properly. Our code, for instance, has some pre-userobject leftovers, as well as deprecated features such as MDI, PBNI etc. I'm wondering how much help will we get from the VS shell when it comes to refactoring capabilities - breaking long functions into separate ones, finding all callers of a certain function or event etc.
The classic IDE is horrible for such tasks. Has using VS now made them easier?
The answers to your questions are YES for the most part but not as cool as in Visual Studio. The PB IDE is night and day better than it was just not quite up to the full Visual Studio IDE.
PB does have some basic refactoring built in, for example something like a function rename across the entire project can be done easily. Here is the output generated when I renamed a function in one of my projects. And I had one of the files opened, the Visual Studio Shell detected it and asked me to reload the local file.
Replace all "ConnectDB", "DBConnect", Subfolders, Find Results 1, "Entire Solution"
H:\Dev\PBWS\pb_data.pbl\pb_data.sra(42,18):liRtn = gnv_data.DBConnect()
H:\Dev\PBWS\pb_data.pbl\n_data_factory.sru(29,25):public function integer DBConnect ()
H:\Dev\PBWS\pb_data.pbl\n_data_factory.sru(38,14):liRowCount = DBConnect()
H:\Dev\PBWS\pb_data.pbl\n_data_factory.sru(103,25):public function integer DBConnect ();
Total replaced: 4 Matching files: 2 Total files searched: 13
PowerBuilder 12.5.NET does have "Go To --> Definition" ability for jumping to function/class declarations. It isn't as cool as Visual Studio in that the PowerBuilder functions aren't as "open" as the .NET framework so you can't right click on GetItemString function and expect to see the internal declarations.
I haven't seen any impact analysis type features yet, like the ability to see where your functions are being called, but I haven't looked too hard yet.
On a positive note Sybase has incorporated the awesome intellisense / code completion of Visual Studio. It is responsive, accurate, and predictive much like when working in Visual Studio IDE doing C#. The PB.NET features along with nice stuff from Visual Studio Shell make PB development fun to work with again.
I have been having constant struggle with Visual Studio debugger and finally got fed up and seeking help. There are some issues constantly causing trouble. If you have any solutions I will be grateful
Trying to watch a function that has const and non-const versions results in ambiguous symbol error (CXX0039)
Trying to get value of a function in a template class randomly gives member function is not defined error (CXX0052)
Casting a template type variable results in bad type cast, even to its own type (CXX0019)
I have visual studio 2010 Professional with SP1
EDIT
In #2, I am sure that inlining is off.
Thanks in advance,
Cem
I've just experienced the same problem...
Found the answer after some searching on MSDN.
Visual Studio 2005 C++ CXX0052: member function not present!
Basically what you need to do is to store the result in a temp variable, and view this temp variable in the Watch or Locals window.
Far from an ideal solution I guess, but it works ( on VS2010 SP1 ).
I have found out that the best option is to modify autoexp.dat and show transformed variables. At start its a bit hard but when you are done its even better than getting these problems fixed.
Is it possible and if so how, to make Visual Studio highlight dynamic expressions in code?
When I just hovered above some code, visual studio told me it was a dynamic expression. This made me realize I made a mistake in my code and used one dynamic too many. But I also realized that if I had not hovered, a 'huge swath' of dynamic code that was supposed to be static would have escaped.
So I wondered if it is possible to make Visual Studio change the background color of dynamic expressions, so those pieces will be clearly recognizable.
[edit]
With dynamic expressions I mean the use of the dynamic keyword in regular code.
You would need an Extension. You can create your own, but I would suggest getting pre-built ones.
Visual Studio has a lot of extensions lately, because of it's popularity.
There are many options I could suggest, but many are rather buggy, so I would suggest using one of the safer, more well known ones like Resharper (my all time favorite and that of many others as well)
I also like JustCode.
There are so many others available though, and if you want to find them, cruise down the Visual Studio Gallery like Morvader said.
Visual Studio Gallery
EDIT:
2 notes I forgot to mention:
Dynamic Intellisense is included in Resharper
Dynamic Highlighting is included as well. If you want to modify the color from the default light blue you can go to Tools->Options...->Environments->Fonts and Colors->Display items->ReSharper Late Bound Identifier
Also make sure that in Resharper->Options...->Code Inspection->Settings "Enable code analysis" and "Color identifiers" are checked.
Please, I would like to know what kind of vb6 or vb file generates DataReport. For example vb calender is generated by MSCAL.OCX, vb dataGrid is generated by MSDATGRD.OCX, CommonDialog is generated by COMDLG32.OCX, ms data report designer v6.0 is generated by MSDBRPT.DLL
I'm not familiar with VB6 anymore but I think this may come from msdbrptr.dll.