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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

GetObject Hangs Excel Worksheet in save

Status
Not open for further replies.

blacy

Technical User
Jun 17, 2000
16
I am opening an Excel worksheet and populating a cell in a named range called "MyName" with data from Access form. This works fine but when I return to Excel it is hung in the Save file mode! Excel appears to be closed but when I return to Excel I get this problem. What am I missing here?

Private Sub Command148_Click()

Dim obj As Object
Set obj = GetObject(Me.[QuoteFilePath] & "/" & "Test1.xls")
obj.Application.Visible = True
obj.Windows(1).Visible = True
obj.Application.ScreenUpdating = False
obj.Application.Goto "MyName"
obj.Application.ActiveCell.FormulaR1C1 = [QuoteRef]
obj.SaveAs [QuoteFilePath] & "/" & "Test1.xls"
obj.Application.Quit 'exit Excel


End Sub
 
What about this ?
Dim obj As Object
Set obj = GetObject(Me![QuoteFilePath] & "/" & "Test1.xls")
obj.Application.Visible = True
obj.Range("MyName").FormulaR1C1 = Me![QuoteRef]
obj.Save
obj.Application.Quit 'exit Excel

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
PHV,

Thanks for your quick response!

I got the following error:
Runtime error 438
Object does not support the property or method

'''''
obj.Range("MyName").FormulaR1C1 = Me![QuoteRef]
'''''

Thanks,
Blake

 
Perhaps this ?
obj.Application.Range("MyName").FormulaR1C1 = Me![QuoteRef]
Or this ?
obj.ActiveSheet.Range("MyName").FormulaR1C1 = Me![QuoteRef]

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
PHV,

(I get an error on this one)
obj.Application.Range("MyName").FormulaR1C1 = Me![QuoteRef]

(This works but I still have the original problem)
obj.ActiveSheet.Range("MyName").FormulaR1C1 = Me![QuoteRef]

Maybe I'm doing this all wrong? Maybe there is a better way?

Do you have any suggestions? THanks for the help!

BL

 
What is your actual code ?
What is really happening when you do what ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I am opening an Excel worksheet and populating a cell in a named range called "MyName" with data from Access form. This works fine but when I return to Excel it is hung in the Save file mode! Excel appears to be closed but when I return to Excel I get this problem.

When I return to Excel a partial screen appears at the top of the monitor and all I can do is X out. When I reopen Excel a Save Dialog pops up asking me to save the file I editied.

Actual code as of now!

Private Sub Command148_Click()
Dim obj As Object
Set obj = GetObject(Me![QuoteFilePath] & "/" & "Test1.xls")
obj.Application.Visible = True
obj.ActiveSheet.Range("MyName").FormulaR1C1 = Me![QuoteRef]
obj.SaveAs Me![QuoteFilePath] & "/" & "Test1.xls"
'obj.Application.Quit 'exit Excel
End Sub

THanks, BL

 
As I already suggested you, replace this:
obj.SaveAs Me![QuoteFilePath] & "/" & "Test1.xls"
with this:
obj.Save

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top