Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This code works the first time. It will give the right
answer in the msgbox 1 every other time I run it the msgbox returns 0. If I remove the getobject call and use only creatobject then the code runs every other time. The code will open Excel on the second run but then hangs. I have to close Excel manually. After that, the code will run a 3rd time but fail the fourth run. It seems that Excel is not closing properly. I am calling Excel from Outlook. Any help would be greatly appreciated Thanks in advance Mike public dim goodfiles() Sub test2() Dim goodfiles(5) As Integer Dim xl As Object On Error Resume Next Set xl = GetObject("excel.application") If Err < 0 Then Err.Clear Set xl = CreateObject("Excel.Application") End If xl.Application.Workbooks.Open _ FileName:=("c:\windows\application data\microsoft\excel\xlstart\personal.xls") xl.Application.Visible = True xl.Parent.Windows(1).Visible = True xl.Application.Workbooks.Open _ FileName:=("c:\DVW\REPORTS\finchk.xls") goodfiles(1) = Range("a30").Value xl.Application.ActiveWorkbook.Save xl.Application.Quit Set xl = Nothing MsgBox goodfiles(1) End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
vba code runs...need spaces ........ | Excel Discussion (Misc queries) | |||
Can you code a macro so it runs multiple times in the same workboo | Excel Discussion (Misc queries) | |||
How to keep from going dizzy when my code runs | Excel Programming | |||
Code that runs each time AFTER a sheet is cut off the book | Excel Programming | |||
OnTime method only runs 1 time | Excel Programming |