excel - Method Range of Object Global failed when using named range -
I am trying to create a VBA script, which runs a selected script in SQL and pastes it in the named category is. Below is my code; ADODB.Connection Dim rcrds like ADODB.Recordset sub runQuery (string as strsQL, as rngResults range) option rcrds = new ADODB.Recordset rcrds.Open StrSQL, cnt, adOpenDynamic, AdLockOptimistic, adCmdText rngResults.ClearContents rngResults.CopyFromRecordset rcrds ending deputy folk sub update_Scorecard_2 () dim as stroked string as myrange range application. ScreenAppting = Incorrect set cnt = new ADODB.Connection cnt.Open "Provider = MSDAORA; Data Source = ODSPRD01; user id = DWH_ADH; password = mypassword; "call runQuery (range (" DATA_DUMP_SQL "). Value, range (" DATA_DUMP ") cnt. Close end Sub
I have the error "the method range of the object global is failing". I think it is an issue with Vba, to know if it does not appear in the sheet , But I understand that it should not be an issue with the named category?
What's wrong with my code?
Comments
Post a Comment