+ Reply to Thread
Results 1 to 1 of 1

Thread: dbf to pivot table

  1. #1
    Registered User
    Join Date
    09-30-2010
    Location
    Pittsburgh, Pa
    MS-Off Ver
    Excel 2007
    Posts
    1

    dbf to pivot table

    I need help getting excel to pull information from file 2010 09 27 0000 (Wide).dbf and put it into a pivot table. The current code works when the DataFile = "" & Year1 & Month1 & "~2"
    But that code will pick whatever ~2 is with that year and month, and I need to single out a certain day. Also if the (Wide) is added it automatically changes the parenthesis to brackets. Any help is much appreciated.


     Month1 = Left(Format(Calendar1.Value, "mm/dd/yyyy"), 2)
        Year1 = Calendar1.Year
        Day1 = Calendar1.Day
        N1 = "0000"
        M1 = "(Wide)"
        DataFile = "" & Year1 & " " & Month1 & " " & Day1 & " " & N1 & " " & M1 & ".dbf"
    
    Range("A7").Select
        ActiveSheet.PivotTables("PivotTable3").PivotSelect "", xlDataAndLabel, True
        Selection.Delete Shift:=xlToLeft
        With ActiveWorkbook.PivotCaches.Add(SourceType:=xlExternal)
            .Connection = Array( "network information" ) <---- ignore this line
            .CommandType = xlCmdTable
            .CommandText = Array(DataFile)
            .MaintainConnection = True
            .CreatePivotTable TableDestination:="Sheet1!R3C1", _
            TableName:="PivotTable3", DefaultVersion:=xlPivotTableVersion10
        End With
    Last edited by MechEng; 09-30-2010 at 11:52 AM. Reason: added code tags

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.2.0