CornFused9899
New Member
- Joined
- Jun 17, 2018
- Messages
- 2
[FONT="]I am trying to update a Macro that I recorded so that content from the lines in the spreadsheet will update the web query target but have run into a a few errors. I've sorted through several of them but the current issue is a Runtime error. The following is the code for my query:[/FONT]
[FONT="]Sub GetAllPkgInfo()[/FONT]
[FONT="] Sheets("AllPkgs").Select[/FONT]
[FONT="] Range("A2").Select[/FONT]
[FONT="] [/FONT]
[FONT="] Do Until ActiveCell.Value = ""[/FONT]
[FONT="] Call PkgInfo1[/FONT]
[FONT="] Loop[/FONT]
[FONT="]End Sub[/FONT]
[FONT="]Sub PkgInfo1()[/FONT]
[FONT="]'[/FONT]
[FONT="]' PkgInfo1 Macro[/FONT]
[FONT="]' Import RHEL package information from RPMFind[/FONT]
[FONT="]'[/FONT]
[FONT="]' Keyboard Shortcut: Ctrl+Shift+D[/FONT]
[FONT="]'[/FONT]
[FONT="] Selection.Copy[/FONT]
[FONT="] Sheets("WebQuery").Select[/FONT]
[FONT="] ActiveSheet.Cells.Clear[/FONT]
[FONT="] Range("$G$1").Select[/FONT]
[FONT="] ActiveSheet.Paste[/FONT]
[FONT="] Application.CutCopyMode = False[/FONT]
[FONT="] With ActiveSheet.QueryTables.Add( _[/FONT]
[FONT="] Connection:="URL;https://rpmfind.net/linux/rpm2html/search.php?query=" & _[/FONT]
[FONT="] Range("$G$1").Value, Destination:=Range("$A$1"))[/FONT]
[FONT="] .CommandType = 0[/FONT]
[FONT="] .Name = "search.php?query=abrt_1"[/FONT]
[FONT="] .FieldNames = True[/FONT]
[FONT="] .RowNumbers = False[/FONT]
[FONT="] .FillAdjacentFormulas = False[/FONT]
[FONT="] .PreserveFormatting = True[/FONT]
[FONT="] .RefreshOnFileOpen = False[/FONT]
[FONT="] .BackgroundQuery = True[/FONT]
[FONT="] .RefreshStyle = xlInsertDeleteCells[/FONT]
[FONT="] .SavePassword = False[/FONT]
[FONT="] .SaveData = True[/FONT]
[FONT="] .AdjustColumnWidth = True[/FONT]
[FONT="] .RefreshPeriod = 0[/FONT]
[FONT="] .WebSelectionType = xlSpecifiedTables[/FONT]
[FONT="] .WebFormatting = xlWebFormattingNone[/FONT]
[FONT="] .WebTables = "2"[/FONT]
[FONT="] .WebPreFormattedTextToColumns = True[/FONT]
[FONT="] .WebConsecutiveDelimitersAsOne = True[/FONT]
[FONT="] .WebSingleBlockTextImport = False[/FONT]
[FONT="] .WebDisableDateRecognition = False[/FONT]
[FONT="] .WebDisableRedirections = False[/FONT]
[FONT="] .Refresh BackgroundQuery:=False[/FONT]
[FONT="] End With[/FONT]
[FONT="] ActiveCell.Offset(1, -5).Range("A1").Select[/FONT]
[FONT="] Selection.Copy[/FONT]
[FONT="] Sheets("AllPkgs").Select[/FONT]
[FONT="] ActiveCell.Offset(0, 1).Range("CombinedPackages[[#Headers],[Column1]]").Select[/FONT]
[FONT="] ActiveSheet.Paste[/FONT]
[FONT="] Sheets("WebQuery").Select[/FONT]
[FONT="] ActiveCell.Cells.Select[/FONT]
[FONT="] Application.CutCopyMode = False[/FONT]
[FONT="] Selection.QueryTable.Delete[/FONT]
[FONT="] Selection.ClearContents[/FONT]
[FONT="] Sheets("AllPkgs").Select[/FONT]
[FONT="] ActiveCell.Offset(1, -1).Range("CombinedPackages[[#Headers],[Column1]]").Select[/FONT]
[FONT="]End Sub[/FONT]
[FONT="]The error message I receive states "Runtime error '1004': Paste Method of Worksheet Class Failed" and highlights the first code instance of [/FONT]
[FONT="] ActiveSheet.Paste[/FONT][FONT="]Can anybody help me get straightened out please?[/FONT]
[FONT="]Sub GetAllPkgInfo()[/FONT]
[FONT="] Sheets("AllPkgs").Select[/FONT]
[FONT="] Range("A2").Select[/FONT]
[FONT="] [/FONT]
[FONT="] Do Until ActiveCell.Value = ""[/FONT]
[FONT="] Call PkgInfo1[/FONT]
[FONT="] Loop[/FONT]
[FONT="]End Sub[/FONT]
[FONT="]Sub PkgInfo1()[/FONT]
[FONT="]'[/FONT]
[FONT="]' PkgInfo1 Macro[/FONT]
[FONT="]' Import RHEL package information from RPMFind[/FONT]
[FONT="]'[/FONT]
[FONT="]' Keyboard Shortcut: Ctrl+Shift+D[/FONT]
[FONT="]'[/FONT]
[FONT="] Selection.Copy[/FONT]
[FONT="] Sheets("WebQuery").Select[/FONT]
[FONT="] ActiveSheet.Cells.Clear[/FONT]
[FONT="] Range("$G$1").Select[/FONT]
[FONT="] ActiveSheet.Paste[/FONT]
[FONT="] Application.CutCopyMode = False[/FONT]
[FONT="] With ActiveSheet.QueryTables.Add( _[/FONT]
[FONT="] Connection:="URL;https://rpmfind.net/linux/rpm2html/search.php?query=" & _[/FONT]
[FONT="] Range("$G$1").Value, Destination:=Range("$A$1"))[/FONT]
[FONT="] .CommandType = 0[/FONT]
[FONT="] .Name = "search.php?query=abrt_1"[/FONT]
[FONT="] .FieldNames = True[/FONT]
[FONT="] .RowNumbers = False[/FONT]
[FONT="] .FillAdjacentFormulas = False[/FONT]
[FONT="] .PreserveFormatting = True[/FONT]
[FONT="] .RefreshOnFileOpen = False[/FONT]
[FONT="] .BackgroundQuery = True[/FONT]
[FONT="] .RefreshStyle = xlInsertDeleteCells[/FONT]
[FONT="] .SavePassword = False[/FONT]
[FONT="] .SaveData = True[/FONT]
[FONT="] .AdjustColumnWidth = True[/FONT]
[FONT="] .RefreshPeriod = 0[/FONT]
[FONT="] .WebSelectionType = xlSpecifiedTables[/FONT]
[FONT="] .WebFormatting = xlWebFormattingNone[/FONT]
[FONT="] .WebTables = "2"[/FONT]
[FONT="] .WebPreFormattedTextToColumns = True[/FONT]
[FONT="] .WebConsecutiveDelimitersAsOne = True[/FONT]
[FONT="] .WebSingleBlockTextImport = False[/FONT]
[FONT="] .WebDisableDateRecognition = False[/FONT]
[FONT="] .WebDisableRedirections = False[/FONT]
[FONT="] .Refresh BackgroundQuery:=False[/FONT]
[FONT="] End With[/FONT]
[FONT="] ActiveCell.Offset(1, -5).Range("A1").Select[/FONT]
[FONT="] Selection.Copy[/FONT]
[FONT="] Sheets("AllPkgs").Select[/FONT]
[FONT="] ActiveCell.Offset(0, 1).Range("CombinedPackages[[#Headers],[Column1]]").Select[/FONT]
[FONT="] ActiveSheet.Paste[/FONT]
[FONT="] Sheets("WebQuery").Select[/FONT]
[FONT="] ActiveCell.Cells.Select[/FONT]
[FONT="] Application.CutCopyMode = False[/FONT]
[FONT="] Selection.QueryTable.Delete[/FONT]
[FONT="] Selection.ClearContents[/FONT]
[FONT="] Sheets("AllPkgs").Select[/FONT]
[FONT="] ActiveCell.Offset(1, -1).Range("CombinedPackages[[#Headers],[Column1]]").Select[/FONT]
[FONT="]End Sub[/FONT]
[FONT="]The error message I receive states "Runtime error '1004': Paste Method of Worksheet Class Failed" and highlights the first code instance of [/FONT]
[FONT="] ActiveSheet.Paste[/FONT][FONT="]Can anybody help me get straightened out please?[/FONT]