Ask Question Forum:
C
O
M
P
U
T
E
R
2
8
- Underline
- Bold
- Italic
- Indent
- Step
- Bullet
- Quote
- Cut
- Copy
- Paste
- Table
- Spelling
- Find & Replace
- Undo
- Redo
- Link
- Attach
- Clear
- Code
Y-position of the mouse cursor
Attachment:===
application.run in standalone mode by VBA

Question-1
When open new excel application in my VBA code and using application.run to
run the new excel window application module, "'newexcel.xls'!S_main" but
it will take some time to finish the task and the main.xls with VBA code and excel
file is hang-up to stop any editing until
the application is finished. The question is that how can I let the the application.run
function running in background task that won't affect my vba or excel editing or doing
other job in the orginal VBA file, main.xls
'Main.xls file with VBA code
Sub main()
Dim ex As New Excel.Application
ex.Run "'newexcel.xls'!S_main"
ex.ActiveWorkbook.Save
ex.quit
end sub
Question-2, From the question-1 above, I think using Shell command might
be working that won't affect operation of original main.xls file because no any
excel application command involve. RIght ? Could shell command call the
newexcel.xls!Smain module instead of program of newexcel.xls
Please advise
Duncan
I tried the shell command , the excel is opened and it can open the file without S_main
module name invlove but can't
run S_main module by the command. Please comment these for the following code .
Application.run can run the module but shell comand is only running the file not module, Right ?
Sub test()
Dim wkdir As String
Dim datafilename As String
Application.ScreenUpdating = False
wkdir = ActiveWorkbook.Path
datafilename = wkdir & "'newexcel.xls'!S_main"
Debug.Print datafilename
Shell "C:Program FilesMicrosoft OfficeOFFICE11Excel.exe " & datafilename, vbNormalFocus '''''''THe error can't find the file """
End Sub
I tried the shell command , the excel is opened and it can open the file without S_main
module name invlove but can't
run S_main module by the command. Please comment these for the following code .
Application.run can run the module but shell comand is only running the file not module, Right ?
Sub test()
Dim wkdir As String
Dim datafilename As String
Application.ScreenUpdating = False
wkdir = ActiveWorkbook.Path
datafilename = wkdir & "'newexcel.xls'!S_main"
Debug.Print datafilename
Shell "C:Program FilesMicrosoft OfficeOFFICE11Excel.exe " & datafilename, vbNormalFocus '''''''THe error can't find the file """
End Sub
I tried the shell command , the excel is opened and it can open the file without S_main
module name invlove but can't
run S_main module by the command. Please comment these for the following code .
Application.run can run the module but shell comand is only running the file not module, Right ?
Sub test()
Dim wkdir As String
Dim datafilename As String
Application.ScreenUpdating = False
wkdir = ActiveWorkbook.Path
datafilename = wkdir & "'newexcel.xls'!S_main"
Debug.Print datafilename
Shell "C:Program FilesMicrosoft OfficeOFFICE11Excel.exe " & datafilename, vbNormalFocus '''''''THe error can't find the file """
End Sub