Click here to Skip to main content
15,896,448 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
HI All,

I have created macro in Access DB. Now i want to run that macro from Windows Vb.net.

Here is my code....

VB
Dim oAccess As Object
oAccess = CreateObject("Access.Application")
oAccess.Visible = True
oAccess.OpenCurrentDatabase("\\Asihydfp01n1\it\Soft\IT-US\CSSD\ITS-US-LA\Sucharitha\TestCase\TestC.mdb")
oAccess.DoCmd.RunMAcro("macro1", lbluid)
oAccess.CloseCurrentDatabase()
System.Runtime.InteropServices.Marshal.ReleaseComObject(oAccess)
oAccess = Nothing


************
But it won't affect in DB.
after this i am not able to open the Access DB.

Please any suggestions


Thanks in Advnace
Sucharitha
Posted
Updated 17-Jul-13 2:43am
v2
Comments
ZurdoDev 17-Jul-13 8:43am    
What do you mean it won't affect in db? And why can't you open the database?
Maciej Los 17-Jul-13 9:18am    
What this macro does? What do you want to achieve? Please, be more specific and provide more details. Use "Improve question" widget.

1 solution

First of all, read my comment to the question. Because you didn't answer me, i can only suggest to...

Don't do this in that way!

Rather than calling macro, try to write code to do the same what macro do.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900