1 Reply Latest reply: Jan 13, 2011 5:58 PM by AustinJohansen RSS

    Export Table Macro in QV 10

      Hi All,

      I am trying to write a macro to export data from a table from QV to an excel spreadsheet. I am new to this and so I am having trouble debugging and fixing the error that I am receiving. Here is the macro so far..

      Set AD=ActiveDocument
      Set MN=AD.Fields("Month_Name")
      Set XLApp = CreateObject("Excel.Application")
      Path = "RightPath"
      FileName = "RigthFile.xls"

       

      XLApp.Visible=True
      Set XLS = XLApp.Workbooks.Open(Path & FileName)



       

      XLS.Worksheets("JanData").Visible = True

      'Jan
      MN.Select "Jan"
      ActiveDocument.GetSheetObject(6).CopyTableToClipboard True
      XLS.Worksheets("JanData").Range("B1").Select
      XLS.Worksheets("JanData").Paste()

       

      ****Then I get this error on the bolded and underlined row:"Select method of Range class failed"

      Any suggestions as to why this macro errors out on this row would be great.

      Thanks,

      Austin