macro refuses to run on open
Posted by Dwight on August 06, 2001 12:30 PM
I have a (lengthy) macro which essentially runs a Web Query to get a current stock quote and pastes the value into my spreadsheet (plus a lot of formatting which makes for the length). The macro works fine when I run it after opening the spreadsheet, but when I try to have it run automatically by pasting it into the This Workbook module in VBA Project (after code: Private Sub Workbook_Open() I get a Run-time error 1004 message, and when I select debug it highlights the line: Selection.QueryTable.Refresh BackgroundQuery:=False. The spreadsheet isnt protected at any time.
If this provides enough information, can anyone tell me what I might be doing wrong?