FrEaK_aCcIdEnT
Board Regular
- Joined
- May 1, 2012
- Messages
- 104
- Office Version
- 365
- Platform
- Windows
- Web
I have a script that I use to run a macro within and Access DB. Once the new table is populated I perform a send key function to get the data to the clipboard so I can process it through some Excel VBA to get the data formatted and a summary report generated, then exported and emailed.
My problem is that unless I keep my computer unlocked it will not perform the send keys functions below. I am trying to find a way to programatically handle this. I have a workaround, but it is not a secure one... I have a VBScript to keep the computer from locking out... I did this to test the send keys below. I can't leave that running over night while I am not here. Its one of those IT security no no thingies. lol
If I can handle this within Access adding to the macro, I will. I do not have experience with the VBA context in Access. I am more akin to Excel and currently picking up VBScript. Powershell is next on my list...
I appreciate any assistance I can get.
My problem is that unless I keep my computer unlocked it will not perform the send keys functions below. I am trying to find a way to programatically handle this. I have a workaround, but it is not a secure one... I have a VBScript to keep the computer from locking out... I did this to test the send keys below. I can't leave that running over night while I am not here. Its one of those IT security no no thingies. lol
If I can handle this within Access adding to the macro, I will. I do not have experience with the VBA context in Access. I am more akin to Excel and currently picking up VBScript. Powershell is next on my list...
I appreciate any assistance I can get.
Code:
Dim acsApp,xlApp,xlBook
'open MS Access and run macro to pull the data from multiple tables.
Set acsApp = createObject("Access.Application")
Set xlApp = CreateObject("Excel.Application")
Set WshShell = WScript.CreateObject("WScript.Shell")
acsApp.visible = true
acsApp.UserControl = true
acsApp.OpenCurrentDataBase("CHANGE ME"
acsApp.DoCmd.RunMacro "CHANGE ME"
'copy raw data to clipboard
[COLOR=#0000ff][B]WshShell.SendKeys "^a"[/B][/COLOR]
[B][COLOR=#0000ff]WshShell.SendKeys "^c"[/COLOR][/B]
'allow time for everything to copy
WScript.Sleep (15*1000)