Does anyone know of a macro function in OpenOffice like exec() or system() in other languages?
You can use SystemShellExecute
Related
i want to execute VBA code, which is stored as a string, i would like to execute this, for example :
dim code as string
code = "Msgbox ""test"""
ExecuteCommand(code)
Please help me to execute this . Thanks :)
I believe Eval will work in Access with functions as long as the function call includes parenthesis
code = "Msgbox(""test"")"
Eval(code)
ref: Eval function
For a project, I need to import a DLL made in Delphi and call some functions.
However, nobody in the projectteam knows how to get this done. Our company supervisor made a program in C++ to open the DLL and call the functions, but he has not the experience in VBA.
Our project is to call the functions and pass some parameters from an excel worksheet to a program (Gas turbine Simulation Project). Our first question is: How do we load a Delphi dll in VBA? I read about the function dllimport, but still i don't know how to use this function.
For example, within the dll there is a function: d4868activateLog
The code in Delphi is as followed:
function activateLog (const filename: PAnsiChar):Integer;
How do we call this function?
You cannot call that function from VBA since it uses the register calling convention. VBA can only import stdcall functions.
You could change the Delphi code to:
function d4868activateLog(const filename: PAnsiChar): Integer; stdcall;
And then in the VBA you would write:
Private Declare Function d4868activateLog Lib "mydll.dll" (ByVal filename As String) As Long
I'm trying to create an AutoExec Macro that'll run a function upon loadup.
I have the function declared and written in a macro called: checkUser
I created an AutoExec Macro, it's code is set to the "RunCode" command, and when I type the "checkUser()" function name, it auto-populates, so obviously it can see it.
However, once I run the AutoExec macro I get this error:
The expression you entered has a function name that Microsoft Access can't find
I've also tried to convert the Autoexec to VBA, and then manually enter the code, when I do I either nothing happens, or I get an error stating that it can't be repeated more than 19 times.
Am I just putting the function in the wrong spot?
As you hint at in your comments, it looks like you have a name resolution issue. If your module name is the same as the function name, you need to further qualify the function name like checkUser.CheckUser()
This was a possibility in VB Script by using a script control with the eval function. For example
ScriptControl1.Eval("(10+1.5)") 'Returns 11.5
Is there a way to do this in Vb.Net? The alternative would be to simply split up the string and verify if it is an addition or a subtracting and work from there. I was just wondering if there's already a built in function that I'm not yet aware of.
Thank you
I figured it out. I had to add a COM reference to Microsoft Script control like so:
Then I just declare my new variable as a Script Control.
Dim ScriptControl1 As New MSScriptControl.ScriptControl()
ScriptControl1.Eval("(10+1.5)") ' Returns 11.5
Note*
Make sure your Target CPU is at x86! I would receive a COMException if i had it set to Any CPU.
I'm planning to create a vb.net program that generates mysql codes.
Is is possible that after the program has generated the code, it will copy it in to the clipboard immediately?
Clipboard.SetText("some test")
If this program is command line, you'll need to add a reference to System.Windows.Forms.
yes, you can just use the Clipboard.SetText(text As String) method to do this.
I have just used the same code;
Clipboard.SetText(Password)