macros

Macro too big to run, keeps 'not responding'.

Hi I have now managed to write my macro but the whole thing stops responding, just a guess but i presume it is because it is asking to check too much data? I have about 3000 rows (but have even tried it on 10). Does anyone know how I can cut this down or mend it to work? Another query on it I have gone to the heading 'sample187' but idea...

Error C2589 on std::numeric_limits<double>::min()

Hi! When I try to compile some code (not my own) i get a C2589 '(':illegal token on right side of'::' on this line: maxPosition[0]=std::numeric_limits<double>::min(); i guess this is because there is already a min() macro defined, but why is the compiler not taking the min() from the specified namespace instead of the macro? ...

How do I create an excel macro that changes the rows spanned by a cell

I am pasting a table into Excel from SAS where the number of rows spanned by the cell in the first column is variable. That is to say sometimes the first column is 3 merged cells, sometimes it is 6, etc. I would like to run a macro that changes the height of the first cell to be 10 merged cells, and to insert rows at the bottom to make...

Force Whitespace in C Macro?

I've got the following Macro to define a new function following a special naming scheme: #define CREATE_HOOK_STUB( func ) void ##func_STUB() { /* some code*/ } However, the preprocessor always concatenates void and ##func_STUB but I obviously want it to preserve the whitespace at that position. I know that I could just prepend some s...

latex command reflection

Hello *, I have the following use case: A table have a section, subsection or subsubsection heading like: \section*{Table name} \begin{tabular*} ... \end{tabular*} Because the table can appear in section, subsection etc. I thought I could define the table header and footer as macros and additionally pass the type of table...

Multi-statement Macros in C++

In C++, is it possible to make a multi-statement macro with nested if statements inside of it like the one below? I've been attempting it for a while now and I'm getting a scope issue for the second if statement not being able to see 'symbol'. Maybe I need to understand macros further. #define MATCH_SYMBOL( symbol, token) if(someth...

excel macro to save as filename excel file and close open excel file

how to add a step at the end of an excel macro to save the processed excel file with name finaloutput.xls in given path on computer and then automatically close the active excel file without saving changes. ...

LaTeX math symbol macro

Hi there, I've long had a dream of creating a "consistent comparison" operator to use in my homework (in LaTeX). That is, in some long derivation, we might want to know how $a$ compares to $b$, and although this is totally contrived, an example might read \begin{align*} a &? b \\ f(a) &? f(b) \\ f(a) &= f(b) \text{by assump...

Visual Studio Macros on 64 bit fail with COM error

I'm doing some javascript development and found a cool macro to region my code ("Using #region Directive With JavaScript Files in Visual Studio"). I used this on my 32 bit box, and it worked first time. (Visual Studio 2008 SP1, Win7) For easy of reference the macro is: Option Strict Off Option Explicit Off Imports System Imports EnvDT...

Regarding macros

Hi all.. i was looking for macro which can expand like the following: FILL_BUFF(4) should be expanded as (0xFF, 0xFF, 0xFF, 0xFF)... what can be the macro written for the above expansion.. ...

How to force user to deal with the Security Warning when starting Access 2007?

Hi! When a user start an Access 2007 database that have macros and vba, a security warning is shown. I want the user to deal with this warning, so if the the content is't enabled, the user should not be able to use the database. Now I use a macro named AutoExec (opens a form that works like a menu), and that macro is run before the us...

A couple of questions about Word macros

I need to grab a list of names from Excel and insert them into a Word document, printing one document per name. The document has some text and a bookmark called "name". The code is below. First, I want to know if it's possible to detect how long is the list of names in the Excel spreadsheet and grab that, instead of hardcoding the numbe...

In C macros, should one prefer do { ... } while(0,0) over do { ... } while(0)?

A customer recently performed static analysis of my employer's C codebase and gave us the results. Among useful patches was the request to change the famous do { ... } while(0) macro to do { ... } while(0,0). I understand what their patch is doing (using the sequence operator to return evaluate to the value of the second "0", so the effe...

C macro/#define indentation?

I'm curious as to why I see nearly all C macros formatted like this: #ifndef FOO # define FOO #endif Or this: #ifndef FOO #define FOO #endif But never this: #ifndef FOO #define FOO #endif (moreover, vim's = operator only seems to count the first two as correct.) Is this due to portability issues among compilers, or is it ...

Custom text macros in Xcode not getting invoked with control-dot

I created an "ObjectiveC.xctxtmacro" file in ~/Library/Application Support/Developer/Shared/Xcode/Specifications with the code bellow. I see "Hello" in Xcode's Edit>Insert Text Macros>Objective-C menu item but when I try to invoke it using control-dot, nothing happens. Any ideas? ( { Identifier = objc.hello; BasedOn = objc...

Regarding macros

Hi all.. may i know what is the problem in using the below x-macro code #define FILL_BUFF_1 (int *)(0x01, 0x02) #define FILL_BUFF_2 (int *)(0x03, 0x04) #define X(a,b) #define LOOK_UP \ X(0x13, FILL_BUFF_1), \ X(0x14, FILL_BUFF_2) #undef X #define X(a,b) a int pid_table[2] = {LOOK_UP}; #undef X #define X(a,b) b int *pid_b...

EDIFACT macro (readable message structure)

Hi, I´m working within the EDI area and would like some help with a EDIFACT macro to make the EDIFACT files more readable. The message looks like this: data'data'data'data' I would like to have the macro converting the structure to: data' data' data' data' Pls let me know how to do this. Thanks in advance! BR Jonas ...

MS Access : Read form control value in a module's function

I have an Access database with a form in which a user clicks a button which in turn runs a macro which also runs a function in a module. Yes, convoluted and no, I am not allowed to change much since it's the customer's application. What I need is to read some combo-boxes and a radio button from the form in the function that's in the mod...

Analysing Excel VBA/Macro code

Is there a tool which will analyse/parse an entire Excel workbook and let us see all the macros, functions, VBA code? I've been given a large number of Excel spreadsheets to analyse, we need to know what they do and how they do it, with a view to creating documentation, and/or re-writing. In many instances the original developers are go...

Is it possible to iterate over arguments in variadic macros ?

Hi, I was wondering if it is possible to iterate over arguments passed to a variadic macro in C99 or using any GCC extensions ? For e.g. is it possible to write a generic macro that takes a structure and its fields passed as arguments and prints offset of each field within the structure ? Something like this: struct a { int a; ...