Results 1 to 8 of 8

Thread: Code suggestions [Resolved]

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2005
    Posts
    10

    Resolved Code suggestions [Resolved]

    First of all, I looked at VB for the first time just Thursday, so excuse my ignorance. If you have any links to good tutorial sites, that would be great. Until then, here is my question. I got my VB code by recording a macro. It imports a search query and displays the results to cell A1. I would like it to display into the first row with no data in it though. I'm not sure how to do this. Right now, my query asks for a certain database number, so if I have to import multiple database numbers to the same sheet, I have to run it three times. But with this code, it will overwrite the previous database. After I figure this out, I'll be working on looping this thing for a certain amount of times. But for the time being, just not erasing the data would be better than what I'm having to do now.

    VB Code:
    1. Sub Macro2()
    2.  
    3.     With ActiveSheet.QueryTables.Add(Connection:= _
    4.         "FINDER;C:\test\Query from MS Access Database.dqy" _
    5.         , Destination:=Range("A1"))
    6.         .Name = "Query from MS Access Database"
    7.         .FieldNames = True
    8.         .RowNumbers = False
    9.         .FillAdjacentFormulas = False
    10.         .PreserveFormatting = True
    11.         .RefreshOnFileOpen = False
    12.         .BackgroundQuery = True
    13.         .RefreshStyle = xlInsertDeleteCells
    14.         .SavePassword = True
    15.         .SaveData = True
    16.         .AdjustColumnWidth = True
    17.         .RefreshPeriod = 0
    18.         .PreserveColumnInfo = True
    19.         .Refresh BackgroundQuery:=False
    20.        
    21.     End With
    22.     Application.Goto Reference:="Macro2"
    23. End Sub
    Last edited by hatemachine; Jan 30th, 2005 at 08:12 PM. Reason: Erased line in code

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width