Runtime Error 1004

netspeedz

New Member
Joined
Aug 11, 2011
Messages
21
Had some problems with a computer so I had to completely reinstall Windows XP and subsequently Microsoft Office 2003. I have an Excel document that had no changes between the time I reinstalled Windows XP and Excel and opened up the Excel document to test the new Office install.

In this Excel document is a button with a macro assigned to it (which, again, has not changed for months). I click on this button and get the error, 'Runtime error 1004. Application defined or object defined error.' I have posted the macro code below (code that charts a range of cells populated with a web query - simple stuff) that the VBA debugger chokes on and have highlighted the specific line as well. It can't be anything with the VBA code or the worksheet because I can take the same Excel document to another computer with Office 2003 installed and it works fine. I'm thinking it has to be a missing Excel/VBA component in the new install - which also baffles me because when I reinstall Office, I do a complete install - getting everything.

Here's the macro code VBA debugger doesn't like:

Sub UpdateChart()


Set Currentchart = Sheets("External Data").ChartObjects(1).Chart


picnm = ThisWorkbook.Path & Application.PathSeparator & "chart.gif"


Currentchart.Export filename:=picnm, FilterName:="GIF"


Image1.Picture = LoadPicture(picnm)


End Sub

The text in red is the line VBA Debugger stops on. Is there some kind of web/internet VBA component I'm forgetting to reinstall?

Any assistance on this would be appreciated.

------------
 
BTW, I have also seen this runtime error 1004 caused by launching a macro using the hot keys combo using the "Shift" key if there is an "open workbook" type line of code anywhere within the macro started with this key combination. It would error on that open workbook line though.

There is a literal bug admitted by Microsoft about this. Normally the "Shift" key can be held down during opening an Excel spreadsheet when you want to bypass any starting of macro's while the program is loading, such as any "Auto_Open" type calls would be bypassed. But the side effect bug of this feature makes an error occur if the "Shift" key is used to launch a macro. Such as "Ctrl-R" would not cause the 1004 error, but the "Ctrl-Shift-R" combo would cause it to error intermittently concerning code anywhere within that macro that is opening a workbook.
 
Last edited:
Upvote 0

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
netspeedz,

I am not asking you to change your code, I suggested to put in some lines which you can take out immediately after to see why you have the problem. Suit yourself, but I thought you wanted help on this
 
Upvote 0
I clearly stated in my original post that the problem was not with the code which implies I will not change code that I know works, i.e., I can take the Excel spreadsheet to any other system and it works fine. That means the problem is Excel/VBA missing some kind of component, add-in or plug-in on my development computer system (after reinstalling Windows and other applications).

I appreciate your time, however, read the original post. It's pretty clear that the problem is not with any VBA code.

netspeedz,

I am not asking you to change your code, I suggested to put in some lines which you can take out immediately after to see why you have the problem. Suit yourself, but I thought you wanted help on this
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,637
Latest member
Ezio2866

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top