这个程序有什么问题,这个程序闪烁'运行时错误1004':application-defind或object-defind错误请帮帮我 [英] What issue is in this program, this program is flashing 'run-time error 1004': application-defind or object-defind error please help me

查看:126
本文介绍了这个程序有什么问题,这个程序闪烁'运行时错误1004':application-defind或object-defind错误请帮帮我的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在这个程序中,我试图从我的shee1中的链接列表中删除数据,并且数据应该在下一张其他表格中复制。



< pre lang =vb> 公共 Sub SUM()
对于 x = 1 3
工作表( sheet1)。选择
工作表( sheet1)。激活
mystr = URL; http://www.medifee.com/hospital/9144-kkasturi-medicare -pvt-ltd /
mystr = Cells(x, 1
Worksheets.Add(after:= Worksheets(工作表) .Count))。Name = x
使用 ActiveSheet.Query Tables.Add(连接:= _
mystr,_
目的地:=范围( $ B $ 1))
.Name = 9144-kkasturi-medicare-pvt-ltd
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
。 SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlAllTables
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = < span class =code-keyword> False
.WebDisableRedirections = False
.Refresh BackgroundQuery:= False
结束 使用
下一步 x
结束 Sub





错误massege:运行时错误1004':



应用程序定义或对象定义错误

行否:8



我的尝试:



这个程序有什么问题,这个程序闪烁'运行时错误1004':应用程序定义或对象定义错误请帮帮我。



在这个程序中,我试图从我的shee1中的链接列表中删除数据,并且数据应该在下一个其他表中复制。

解决方案

B


1))
.Name = 9144-kkasturi-medicare-pvt-ltd
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDelet eCells
.SavePassword = False
.SaveData = True
。 AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlAllTables
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:= False
End 使用
下一步 x
结束 Sub





错误massege:运行时错误1004' :



应用程序定义或对象定义错误

行号:8



我尝试了什么:



这个程序有什么问题,这个程序闪烁'运行时错误1004':应用程序定义或对象定义错误请帮助我。



在这个程序中我试图从我的shee1链接列表中删除数据,并且数据应该在下一张其他表中复制。


检查一下:

 公共  Sub  SUM()
Dim wsh 作为工作表
Dim mystr 作为 字符串
Dim qt As QueryTable
Dim x As < span class =code-keyword>整数

开启 错误 恢复 下一步


对于 x = 1 3
mystr = URL; http://www.medifee.com/hospital / 9144-kkasturi-medicare-pvt-ltd /
' mystr = Cells(x ,1)'这取代原始连接字符串!
设置 wsh = ThisWorkbook.Worksheets.Add(After:= ThisWorkbook.Worksheets(ThisWorkbook。 Worksheets.Count))
wsh.Name = x

设置 qt = wsh.QueryTables(x)
如果 qt 没什么 然后 wsh.QueryTables(x )。删除

使用 wsh.QueryTables.Add(连接:= mystr,目的地:=范围(


In this program i am trying to scrap data from the list of link which is in my shee1,And data should be copy in next other sheets.

Public Sub SUM()
For x = 1 To 3
    Worksheets("sheet1").Select
    Worksheets("sheet1").Activate
    mystr = "URL;http://www.medifee.com/hospital/9144-kkasturi-medicare-pvt-ltd/"
    mystr = Cells(x, 1)
    Worksheets.Add(after:=Worksheets(Worksheets.Count)).Name = x
    With ActiveSheet.QueryTables.Add(Connection:= _
    mystr, _
        Destination:=Range("$B$1"))
        .Name = "9144-kkasturi-medicare-pvt-ltd"
        .FieldNames = True
        .RowNumbers = False
        .FillAdjacentFormulas = False
        .PreserveFormatting = True
        .RefreshOnFileOpen = False
        .BackgroundQuery = True
        .RefreshStyle = xlInsertDeleteCells
        .SavePassword = False
        .SaveData = True
        .AdjustColumnWidth = True
        .RefreshPeriod = 0
        .WebSelectionType = xlAllTables
        .WebFormatting = xlWebFormattingNone
        .WebPreFormattedTextToColumns = True
        .WebConsecutiveDelimitersAsOne = True
        .WebSingleBlockTextImport = False
        .WebDisableDateRecognition = False
        .WebDisableRedirections = False
        .Refresh BackgroundQuery:=False
    End With
    Next x
End Sub



error massege: run-time error 1004':

Application-defind or object-defind error
line no: 8

What I have tried:

what issue is in this program, this program is flashing 'run-time error 1004': Application-defind or object-defind error please help me.

In this program i am trying to scrap data from the list of link which is in my shee1,And data should be copied in next other sheets.

解决方案

B


1")) .Name = "9144-kkasturi-medicare-pvt-ltd" .FieldNames = True .RowNumbers = False .FillAdjacentFormulas = False .PreserveFormatting = True .RefreshOnFileOpen = False .BackgroundQuery = True .RefreshStyle = xlInsertDeleteCells .SavePassword = False .SaveData = True .AdjustColumnWidth = True .RefreshPeriod = 0 .WebSelectionType = xlAllTables .WebFormatting = xlWebFormattingNone .WebPreFormattedTextToColumns = True .WebConsecutiveDelimitersAsOne = True .WebSingleBlockTextImport = False .WebDisableDateRecognition = False .WebDisableRedirections = False .Refresh BackgroundQuery:=False End With Next x End Sub



error massege: run-time error 1004':

Application-defind or object-defind error
line no: 8

What I have tried:

what issue is in this program, this program is flashing 'run-time error 1004': Application-defind or object-defind error please help me.

In this program i am trying to scrap data from the list of link which is in my shee1,And data should be copied in next other sheets.


Check this:

Public Sub SUM()
Dim wsh As Worksheet
Dim mystr As String
Dim qt As QueryTable
Dim x As Integer

On Error Resume Next


For x = 1 To 3
    mystr = "URL;http://www.medifee.com/hospital/9144-kkasturi-medicare-pvt-ltd/"
    'mystr = Cells(x, 1) 'this replaces original connection string!
    Set wsh = ThisWorkbook.Worksheets.Add(After:=ThisWorkbook.Worksheets(ThisWorkbook.Worksheets.Count))
    wsh.Name = x
    
    Set qt = wsh.QueryTables(x)
    If Not qt Is Nothing Then wsh.QueryTables(x).Delete
    
    With wsh.QueryTables.Add(Connection:=mystr, Destination:=Range("


这篇关于这个程序有什么问题,这个程序闪烁'运行时错误1004':application-defind或object-defind错误请帮帮我的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆