Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / December 2005

Tip: Looking for answers? Try searching our database.

How to run script in VBA On_Click event

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Daniel - 10 Dec 2005 03:04 GMT
If I have a database of various scripts.  Is there a way that I can launch
the Script contained in the "Script" textbox using the On_click event of a
run button?

Thank you,

Daniel
Branden Johnson - 10 Dec 2005 04:27 GMT
Not exactly sure what you are asking... My first thought is you would have
to place "=RunMyScript()" in the OnClick event of the Run button. Hope this
is what you were looking for.

> If I have a database of various scripts.  Is there a way that I can launch
> the Script contained in the "Script" textbox using the On_click event of a
[quoted text clipped - 3 lines]
>
> Daniel
Daniel - 13 Dec 2005 02:38 GMT
Suppose I have the following in a MEMO field named "Script" in my form (which
contains vbscripts).  I would like to know what vba code could be used in
conjunction with the on_click event to run the code.

******
Const xpRangeAutoFormatList2 = 8

Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
Set objWorkbook = objExcel.Workbooks.Add()
Set objWorksheet = objWorkbook.Worksheets(1)
x=1

strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_Service")
For Each ObjItem in colItems
    objWorksheet.Cells(x,1) = objItem.Name
    objWorksheet.Cells(x,2) = objItem.DisplayName
    objWorksheet.Cells(x,3) = objItem.State
    x = x + 1
Next

Set objRange = objWorksheet.UsedRange
objRange.EntireColumn.Autofit()
objRange.Autoformat(xpRangeAutoFormatList2)
******

> Not exactly sure what you are asking... My first thought is you would have
> to place "=RunMyScript()" in the OnClick event of the Run button. Hope this
[quoted text clipped - 7 lines]
> >
> > Daniel
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.