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!

Error 1004 Method 'ThisWorkbook' of object application failed

Status
Not open for further replies.

vba317

Programmer
Mar 5, 2009
708
US
I am trying to use vba to refresh my excel table. I am getting error 1004. My workbook has three tabs if this makes a difference. Any help would be appreciated.

Code:
In its own module
Public goXL As Excel.Application   

[Yellow] goXL.ThisWorkbook.RefreshAll [/Yellow]
 
hi,

Are you running this code IN ThisWorkbook or not?

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
No, I am runniing it on an access form.

Tom
 
Use goXL.CurrentWorkbook instead, as ThisWorbook has no mraning outside an excel VBA project.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 


goXL.CurrentWorkbook didnt work
goXL.ActiveWorkbook.RefreshAll worked

Thank you for pointing me in the right direction.

Tom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top