Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBScript Running Excel Macros

Status
Not open for further replies.

tater929

IS-IT--Management
Jun 29, 2010
1
US
I am having a problem with a vbscript running an excel macro. The goal here is to have the script run a macro which imports a CSV file into a user's currently open workbook. Here is my code:

Set oExcel = GetObject(,"Excel.Application")

oExcel.Run "ImportCSV" 'runs the macro ImportCSV

oExcel.UserControl = True

set oExcel = nothing

The script does what it's supposed to do but it causes Excel to freeze. I have to use the Task Manager to close Excel. When I reopen the workbook that froze, the csv has been imported correctly (and it apparently saved it automatically). So I just need something to keep Excel from freezing. I think it has something to do with vbscript taking control of the open workbook then being unable to relinquish control. Any ideas?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top