 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Tom Byars Guest
|
Posted: Tue Apr 18, 2006 11:03 am Post subject: How can I run a MS Acess macro from with BCB6? |
|
|
I have Office2K components on my pallette but, I can find no information in
the help for the likes of TAccessApplication or TAllMacros ad the properties
for these are cryptic to say the least. I've googled but found nothing.
Could anyone give me a kick start? |
|
| Back to top |
|
 |
Tom Byars Guest
|
Posted: Sat Apr 22, 2006 1:03 pm Post subject: Re: How can I run a MS Acess macro from with BCB6? |
|
|
I managed to get this to compile and execute but, it doesn't do anything.
TAccessApplication *App=new TAccessApplication(this);
App->OpenCurrentDatabase((wchar_t*)("MyAccessDataDirectory"),true);
tagVARIANT V;
V.vt=VT_BSTR;
V.bstrVal=(wchar_t*)("MyMacroName");
App->DoCmd->RunMacro(V);
Even if it had worked it wouldn't have solved the problem of sending the
macro parameters but it would at least have been a start.
Can no kind soul give me a clue? Everything on google on the subject seems
to be Delphi related and it's no easy task relating it to BCB what with the
missing help files. |
|
| Back to top |
|
 |
Tom Byars Guest
|
Posted: Fri Apr 28, 2006 5:03 pm Post subject: Re: How can I run a MS Acess macro from with BCB6? |
|
|
After days of googling and much guessing this is as far as I got
Variant Access=CreateOleObject("Access.Application");
Access.OleProcedure("OpenCurrentDatabase","MyDatabasePath",true);
Access.OlePropertySet("Visible",true);
//Access.OleProcedure("OpenQuery","MyQuery");
//Access.OleProcedure("DoCmd","RunMacro","MyMacro");
//Access.OleProcedure("DoCmd","OpenQuery","MyQuery");
Access.OleProcedure("CloseCurrentDatabase");
Access.OleProcedure("Quit");
The above code puts Access on the desktop and closes it but, if I uncomment
any of the 3 lines in the middle I get an error message "Name unknown" or
"Member not found" (the latter for the 2 with "DoCmd" as a parameter).
I'm amazed at the lack of documentation on this on Borland's part. There are
numerous similar questions on groups asking for the same help but, all
unanswered. Does anyone know if it's possible to get one of these objects to
list their methods and properties? e.g. something along the lines of
Access.OleProcedure("ListMethods"). |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|