Issue:
I have a VBScript that opens a .xlsm workbook and executes a few macros. The code in the VBScript & VBA macros have all been tested and works perfectly, but only on 1 server, the "Production" server.
When attempting to run the VBS on a second server, the "Test" server, the VBS successfully opens the workbook and successfully executes a preliminary macro to gather process information, but then it hits a very cryptic error when attempting to execute the second macro titled "Auto_Run", after that the VBS closes the workbook and executes the rest of its code perfectly.
Why would this work fine on one server but not the other? Where do I start to troubleshoot this?
If you think you can help but need me to provide something more, by all means please say so and I will provide it.
Details:
The preliminary macro that works is actually 'GetCurrentProcessID' from kernel32. Added to the macro via this line of code:
Declare PtrSafe Function GetCurrentProcessId Lib "kernel32" () As Long
The cryptic error returned from the VBScript when attempting to execute the 2nd Macro: "Auto_Run" on the "Test" server is:
Err.Source = ""
Err.Code = -2147417851
Err.Description = "<Error> | -2147417851: </Error>"
The Sub for the second Macro 'Auto_Run':
Sub Auto_Run()
On Error GoTo e
QLog "'Auto_Run' Starting..."
modMain.bAuto = True
Main bAuto
QLog "'Auto_Run' Completed."
x:
Exit Sub
e:
QLog "'Auto_Run' " & Get_Err
Resume x
End Sub
QLog is a sub that writes the contents of the string parameter passed to it to 3 places, 1 the status bar, 2 a progress indication form (that is only displayed optionally when executed manually) & 3, most importantly, to a database log table.
The second executable line of "Auto_Run" doesn't even execute:
QLog "'Auto_Run' Starting..."
should log to the database log table, but of course it is empty.
Event Viewer:
I checked the Application Log in Event Viewer and found 3 related events.
1 'Application Error' type event:
Faulting application name: EXCEL.EXE, version: 14.0.7177.5000, time stamp: 0x582c88af
Faulting module name: VBE7.DLL, version: 7.0.16.40, time stamp: 0x57fbbbf8
Exception code: 0xc0000005
Fault offset: 0x000000000000278d
Faulting process id: 0x1c0c
Faulting application start time: 0x01d2710609568608
Faulting application path: C:\Program Files\Microsoft Office\Office14\EXCEL.EXE
Faulting module path: C:\PROGRA~1\COMMON~1\MICROS~1\VBA\VBA7\VBE7.DLL
Report Id: 488b9548-dcf9-11e6-bf1b-3a017bdb52e6
1 'Windows Reporting Error' information type event:
Fault bucket , type 0
Event Name: APPCRASH
Response: Not available
Cab Id: 0
Problem signature:
P1: EXCEL.EXE
P2: 14.0.7177.5000
P3: 582c88af
P4: VBE7.DLL
P5: 7.0.16.40
P6: 57fbbbf8
P7: c0000005
P8: 000000000000278d
P9:
P10:
Attached files:
C:\Users\<redacted>\AppData\Local\Temp\2\CVRA045.tmp.cvr
C:\Users\<redacted>\AppData\Local\Temp\WERA9F5.tmp.appcompat.txt
C:\Users\<redacted>\AppData\Local\Temp\WERAB0F.tmp.WERInternalMetadata.xml
C:\Users\<redacted>\AppData\Local\Temp\WERAB2F.tmp.hdmp
C:\Users\<redacted>\AppData\Local\Temp\WERADA0.tmp.mdmp
These files may be available here:
C:\Users\<redacted>\AppData\Local\Microsoft\Windows\WER\ReportQueue\AppCrash_EXCEL.EXE_33353b1e5e166abad4dbe725c82a3feea72c43_cab_be21aeb6
Analysis symbol:
Rechecking for solution: 0
Report Id: c39d1908-dcfb-11e6-bf1b-3a017bdb52e6
Report Status: 4
and lastly 1 more 'Windows Error Reporting' information type:
Fault bucket 422681129, type 28
Event Name: APPCRASH
Response: Not available
Cab Id: 0
Problem signature:
P1: EXCEL.EXE
P2: 14.0.7177.5000
P3: 582c88af
P4: VBE7.DLL
P5: 7.0.16.40
P6: 57fbbbf8
P7: c0000005
P8: 000000000000278d
P9:
P10:
Attached files:
C:\Users\<redacted>\AppData\Local\Temp\2\CVRA045.tmp.cvr
C:\Users\<redacted>\AppData\Local\Temp\WERA9F5.tmp.appcompat.txt
C:\Users\<redacted>\AppData\Local\Temp\WERAB0F.tmp.WERInternalMetadata.xml
C:\Users\<redacted>\AppData\Local\Temp\WERAB2F.tmp.hdmp
C:\Users\<redacted>\AppData\Local\Temp\WERADA0.tmp.mdmp
These files may be available here:
C:\Users\<redacted>\AppData\Local\Microsoft\Windows\WER\ReportArchive\AppCrash_EXCEL.EXE_33353b1e5e166abad4dbe725c82a3feea72c43_b759b319
Analysis symbol:
Rechecking for solution: 0
Report Id: c39d1908-dcfb-11e6-bf1b-3a017bdb52e6
Report Status: 0
What I have tried
I tried setting the Excel Application's Visible property to True & adjusting the "Auto_Run" Sub to something much simpler to see if it would execute & it did not.
VBS:
oXL.Visible = True
oXL.Application.Run "'" & sName & "'!" & sMacro
VBA
Sub Auto_Run()
'Test
MsgBox "Help Me Please"
End Sub
Replies to Comments
Comintern -
These servers are on the same network & the program is being executed by the same AD User.
What other permissions would I have to adjust?
ClintB -
Running under the same AD user on the same network. Also, Excel is successfully opening & executing the first macro, just not the 2nd one.
-- Full Automation Works
Prod Server OS: Windows Server 2008 R2 Standard SP1 - 64 bit
Prod Server XL: 14.07177.5000 (32-bit)
-- Doesn't work
Test Server OS: Windows Server 2008 R2 Enterprise SP1 - 64 bit
Test Server XL: 14.07177.5000 (64-bit)
Nick.McDermaid -
Manual Execution on either server works as expected.
P.S. I apologize if this is a duplicate, but I haven't been able to find anything on this. I'm probably phrasing it poorly but I figured it was worth a shot to ask about it.
0xc0000005
is basically "access denied". I'd check permissions on the problem machine. – Comintern