macros

VBScript to Write a Macro within an Excel file

Is it possible for the VBScript to write a Macro within the excel file when it is generated that would be able to run whenever the file is opened? Ive got a VBScript to auto generate an excel file and some data within it, this runs once and generates the file with all the data/sorts etc. What I need is to have some interactivity that w...

Lock Excel Document after a certain Date

How can I cripple an excel document after a certain date? I want it to become unusable after, say, 12/31/2009. I was thinking about putting one of those Must Enable Macros things in there that hides all the sheets on close and leaves one tab that says you must enable macros. Then having an on open macro that unhides all those tabs, bu...

How can I create a macro for getting the library name a class is compiled into?

How can I create a macro for getting the library name a class is compiled into? Is there some way of getting this information from make? Essentially I'd like to do something like: # define LIBRARY_NAME (get info from make maybe?) ... # ifdef LIBRARY_NAME static const char* s_lib_name = STRINGIZE(LIBRARY_NAME); Thank y...

How do I temporarily disable a macro expansion in C/C++?

For some reason I need to temporarily disable some macros in a header file and the #undef MACRONAME will make the code compile but it will undef the existing macro. Is there a way of just disabling it? I should mention that you do not really know the values of the macros and that I'm looking for a cross compiler solution (should work ...

How can avoid having a solution specific hard coded macro in Visual Studio?

Background I have a macro AttachToRemoteProcess that I use to attach the debugger to a running process on a remote computer. The macro use hard coded names for the process and the computer. I use the macro from a toolbar button on a custom toolbar. I consider this a sub par solution and I don't really like to have such a macro in my Vis...

Excel macro doesn't update correctly

Hi i have created macro for excel but it seems somewhere i have done something wrong, i want to fetch an image from a URL and then update it up to 1 second (more or less) Sub GetPicture() PictureURL = "This is where i put the URLi want" Set MyPict = ActiveSheet.Pictures.Insert(PictureURL) Cells(1).Value = Now nextTime = Now + TimeV...

Can I substitute __func__ into an identifier name in a C macro?

I'd like to write a C macro which takes this: int foo() { MY_MACRO } and expands it to this: int foo() { _macro_var_foo++; } I've found that I can't use __func__, because that doesn't actually get expanded in the macro; it's treated by the preprocessor like a variable. Is there some way to get this to work? ...

Adding content to ms word, Include macro

Hi All, I have a JSP file that is going to flush all data from database into a ms-word document by setting the content-type keyword. Now the problem is I need to add header and footer to the same document for which after many searches couldn't find a direct way from JSP without using APIs like POI. So I went ahead and created a macro for...

Excel Conditional Formatting Using A Reference Range

I have a watch range with certain cells highlighted yellow. For each of these cells, there is a corresponding reference value all located within one column. I want to highlight all cells in my target range red for which the value in the corresponding reference cell matches the value in the target cells. The code I've come up with is a...

Pros and Cons of Different macro function / inline methods in C

According to the C FAQ, there are basically 3 practical methods for "inlining" code in C: #define MACRO(arg1, arg2) do { \ /* declarations */ \ stmt1; \ stmt2; \ /* ... */ \ } while(0) /* (no trailing ; ) */ or #define FUNC(arg1, arg2) (expr1, expr2, expr3) To clarify this one, the arguments are used in ...

Can this be done using excel macos?

Hi Guys, I am new here and have been refered to this site by someone who thinks its the best site for programmers. I also think it is!! I am new to Vb and excel Macros. I want to do the following things with a 13 column and 1000 rows spreadsheet. Determine the Unique items on Column A to J Move the Unique items to a new Sheet Transp...

Are these placement new macros correct ?

I made a couple macros to make using placement new a bit easier. I was just wondering if there were any obvious cases where these would not work. Thanks. #define CONSTRUCT_INPLACE(TYPE,STORAGE,INIT) ::new((TYPE*)STORAGE) TYPE INIT #define DESTRUCT_INPLACE(TYPE,STORAGE) ((TYPE*)STORAGE)->~TYPE() ...

How Does Static Typing Limit Macros?

I was reading Paul Graham's "The Hundred-Year Language" article. http://www.paulgraham.com/hundred.html In there he makes a claim that static typing "preclude[s] true macros". For example, types seem to be an inexhaustible source of research papers, despite the fact that static typing seems to preclude true macros-- without...

Custom C++ Preprocessor / Typeful Macros

Having seen the advantages of metaprogramming in Ruby and Python, but being bound to lower-level languages like C++ and C for actual work, I'm thinking of manners by which to combine the two. One instance comes in the simple problem for sorting lists of arbitrary structures/classes. For instance: struct s{ int a; int b; }; vector<s...

C macro : turn a number into a string

I have a table that defines symbols appearance on a 5x7 dot display. Something like: extern UINT8 symbols[][5] = { {0x0,0x0,0x0,0x0,0x0}, {0x0,0x0,0x5F,0x0,0x0}, {0x0,0x7,0x0,0x7,0x0}, {0x14,0x7F,0x14,0x7F,0x14}, // etc. The leading part of the table matches ASCII table, followed by a set of special symbols, e.g. an ...

Creating C macro with ## and __LINE__ (token concatenation with positioning macro)

I want to create a C macro that creates a function with a name based on the line number. I thought I could do something like (the real function would have statements within the braces): #define UNIQUE static void Unique_##__LINE__(void) {} Which I hoped would expand to something like: static void Unique_23(void) {} That doesn't wor...

Can you give me some real-life examples of the -> macro?

It seems to be a powerful macro, yet I'm failing to apply it to anything but silly examples. Can you show me some real use of it? Thanks! ...

Macro for iterating over a GList

I am using GLib's doubly linked list structure, GList. I would like to know if there is any standard macro for iterating over a GList. I couldn't find any such thing in the GLib documentation. As a result I have made my own macro, but I'd rather use something standard if it exists. To Illustrate the the issue: Usually I write a lot of c...

Trac page with SVN directory list?

Say I have repository structure like: /svn /Department A /MyProj1 /MyProj2 /MyProj3 I'd like to have a page on my Trac wiki which looks like: Projects under Source Control for Department A: - MyProj1 - MyProj2 - MyProj3 Is there an existing plugin, macro, or other neat Trac trick to allow this? I tri...

Mathematica: Unevaluated vs Defer vs Hold vs HoldForm vs HoldAllComplete vs etc etc

I'm bewildered by all the built-in Mathematica functions that purport to prevent evaluation in some way: Unevaluated, Defer, Hold, and over half a dozen of the form Hold*. The Mathematica documentation just explains each function in isolation without explaining why you would choose one or the other. Can anyone offer a coherent explanat...