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
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks