Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
Is there a way to get the new file name (it changes all the time) when refreshing a saved query (imports text file) I'm importing a comma delimited file into Cell N13. I need to get the name of the file being imported and saved in cell B2 to rename the active sheet. Since I now I have the Application.GetOpenFile() is asking twice for the file name. Any help would be more than appreciate Sub Import_PRN() 'import *.prn file to HG sheet Range("N13").Select Dim myfile As Variant Dim F As String Selection.QueryTable.refresh BackgroundQuery:=False myfile = Application.GetOpenFilename("All Files, *.*") F = Mid(myfile, InStrRev(myfile, "\") + 1) Range("B3").Value = F Range("B2").Select End Sub Thanks, -- gaba :) |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Refreshing an Excel Query | Excel Discussion (Misc queries) | |||
Refreshing Data from a web query | Excel Discussion (Misc queries) | |||
Refreshing Query Tables | Excel Programming | |||
Refreshing Query Tables | Excel Programming | |||
Refreshing a query with a changing date | Excel Programming |