Run time error 1004 excel macro8/4/2023 On Error Resume Next ' If Not Empty Cells ' In your conn.string there was one more blank after ' ' MyURL = Worksheets("Sheet2").Range("A1").Text * Make sure the file/path name doesn't contain more than 218 characters.ĭim wks As Worksheet ' Represents a temp.worksheet * Make sure the file name does not contain any of the following characters: * Make sure the folder that contains the file is not read-only. When I trying to extract a web page, it showing an error. Thanks in advance.I need a help with excel vba macro. Given this information (and example) can anything more be suggested? If I hit the 'Debug' button it highlights the '.Refresh BackgroundQuery:=False' line of the code.Īnd no data is returned to the Excel spreadsheet.Ĭlearly this is a simple example - and in this case the use of the temporary table is not essential - but with the workload I'm performing I do need to.Īnd it seems to be this element of it that is causing me the problems with running the stored procedure to Excel. Make sure the exernal database is available and hasn't been moved or reorganized, then try the operation again." Now when I run the macros in my Excel spreadsheet (having cleared all the cells beforehand) I get the error: ![]() Steve RE: Run-time error '1004' when running SQL stored procedure (VB in Excel)Ĭreate proc proc_get_databases int, int, int, int, int)Īgain, when I run this through a query window I get the list of databases as required so the stored procedure still returns a similar result set - albeit done in a different way. However I clearly need to get the result set as provided by the stored procedure originally written.Īnd / or suggest how I can get around this problem?Īny suggestions would be greatly appreciated. "select 'test return field' " - then this runs through to Excel correctly (using the same Vb code through Excel with the same parameters). If I reduce the stored procedure down to a simple result set - i.e. I've gone as far as removing the 'drop table.' statements in case they were causing the issue - but still get the same error and no result set. I think the issue might be due to temporary tables within the stored procedure - with the temp tables being created and made use of in the scope of the stored procedure and then dropped at the end (of the s.p.). It should be noted that the same stored procedure (with the same parameters) runs without any trouble via a Query window - and produces the required result set.Īs such - I'm unable to run this same procedure through to Excel - and need to! Make sure the external database is available and hasn't been moved or reorganized, then try the operation again."Īnd I'm unable to generate the results of the stored procedure. The query did not run, or the database table could not be opened.Ĭheck the database server or contact your database administrator. However I've just introduced a new stored procedure and when I attempt to run this in the same way (whereby all the other stored procedures do far have worked without any problems) I get a 'Microsoft Visual Basic' error: The majority of these are working fine and outputting the cell data as required (and then letting me produce charts from these). ![]() I'm making use of some stored procedures to load cells within an Excel (2007) spreadsheet via macros (with VB code).
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |