+ Reply to Thread
Results 1 to 2 of 2

Opening a file with code without a set file name

  1. #1
    jenkinspat
    Guest

    Opening a file with code without a set file name


    Your such a sweet heart THANK YOU.
    You actualy jogged my memory and made me think of another
    option. I'm gonna try
    ApplicationFindFile so they can select the 1 they need.

    As far as your code i have use for it in my new program im making. Man
    there is much to learn. Nothing like putting the puzzle together hu. i
    love it and you for the help you gave....... XOXO
    Thank you,
    Pj




    JulieD Wrote:
    > Hi
    >
    > how about something like
    >
    > dim fname as string
    >
    > fname = inputbox("What is the name of the file?")-
    >
    > Sheets("stby").Select
    > Application.ScreenUpdating = False
    > ChDir "C:\Pt23 Spread"
    > Workbooks.Open Filename:="C:\Pt23 Spread\" & fname & ".xls"-
    > 'rest of your code
    > ------
    > Cheers
    > JulieD
    >
    >
    > "jenkinspat" [email protected] wrote in
    > message
    > news:[email protected]
    >
    > Sorry for lack of details.
    >
    > Im using simple Excel code in a Module here's what im using.
    >
    > -----
    > Sub ExtractLatData()
    > '
    > '
    >
    > Sheets("stby").Select
    > Application.ScreenUpdating = False
    > ChDir "C:\Pt23 Spread"
    > Workbooks.Open Filename:="C:\Pt23 Spread\sensor.xls"
    > Sheets("RSR Summary").Select
    > Rows("1:14").Select
    > Selection.Delete Shift:=xlUp
    > Columns("A:A").Select
    > Selection.Delete Shift:=xlToLeft
    > Columns("A:L").Select
    > Selection.Copy
    > Application.DisplayAlerts = False
    >
    > ActiveWindow.Close
    > Sheets("RSR Report Data (Errors)").Select
    > Range("A1").Select
    > ActiveSheet.Paste
    > Range("A1").Select
    > ActiveWorkbook.Save
    > Sheets("Control").Select
    > Application.ScreenUpdating = True
    > MsgBox " Finished, Exit EXCEL and open the ACCESS file to view
    > Report "
    > End Sub
    > -------
    > The sensor file name is named different every day and the user has to
    > change the name before running the code. Of course half of them
    > forget
    > to. The file contents of the file are the same except the changes for
    > the test data so it just the (set) name im trying to make easier.
    > Or maby a code that will change the name for them, maby.
    >
    > Thank you,
    > Pat
    >
    >
    >
    >
    >
    >
    >
    >
    >
    > JulieD Wrote:-
    > Hi
    >
    > it would probably help if we could see the code, if you'ld like to
    > copy
    > &
    > paste it (or at least the bit where the file name is referenced) in a
    > reply
    > this would give us a starting point ...
    > and also to know where you run the code from - is it stored in
    > personal
    > and
    > run via tools / macro / macros in the newly created workbook or ??
    >
    > Cheers
    > JulieD
    >
    >
    > "jenkinspat" [email protected] wrote in
    > message
    > news:[email protected]
    >
    > Hi all and thanks in advance for any help.
    >
    > I have excel workbooks that are produced on a daily bases by another
    > program. The data layout is the same for each day produced except for
    > the file name. What im having to do now is rename the file every day
    > and then run my other code to clean it up and import the data into my
    > new workbook.
    > The code that i use works great but would like to be able to fix it
    > so
    > it doesn't matter what the file name is, so that others won't have to
    > remember to change the name before they run the cleanup code. Any
    > ideas.
    > Thanks, Pat
    >
    >
    > --
    > jenkinspat--
    >
    >
    > --
    > jenkinspat-



    --
    jenkinspat

  2. #2
    JulieD
    Guest

    Re: Opening a file with code without a set file name

    glad you found a solution, good luck with the rest of the program

    "jenkinspat" <[email protected]> wrote in message
    news:[email protected]...
    >
    > Your such a sweet heart THANK YOU.
    > You actualy jogged my memory and made me think of another
    > option. I'm gonna try
    > ApplicationFindFile so they can select the 1 they need.
    >
    > As far as your code i have use for it in my new program im making. Man
    > there is much to learn. Nothing like putting the puzzle together hu. i
    > love it and you for the help you gave....... XOXO
    > Thank you,
    > Pj
    >
    >
    >
    >
    > JulieD Wrote:
    >> Hi
    >>
    >> how about something like
    >>
    >> dim fname as string
    >>
    >> fname = inputbox("What is the name of the file?")-
    >>
    >> Sheets("stby").Select
    >> Application.ScreenUpdating = False
    >> ChDir "C:\Pt23 Spread"
    >> Workbooks.Open Filename:="C:\Pt23 Spread\" & fname & ".xls"-
    >> 'rest of your code
    >> ------
    >> Cheers
    >> JulieD
    >>
    >>
    >> "jenkinspat" [email protected] wrote in
    >> message
    >> news:[email protected]
    >>
    >> Sorry for lack of details.
    >>
    >> Im using simple Excel code in a Module here's what im using.
    >>
    >> -----
    >> Sub ExtractLatData()
    >> '
    >> '
    >>
    >> Sheets("stby").Select
    >> Application.ScreenUpdating = False
    >> ChDir "C:\Pt23 Spread"
    >> Workbooks.Open Filename:="C:\Pt23 Spread\sensor.xls"
    >> Sheets("RSR Summary").Select
    >> Rows("1:14").Select
    >> Selection.Delete Shift:=xlUp
    >> Columns("A:A").Select
    >> Selection.Delete Shift:=xlToLeft
    >> Columns("A:L").Select
    >> Selection.Copy
    >> Application.DisplayAlerts = False
    >>
    >> ActiveWindow.Close
    >> Sheets("RSR Report Data (Errors)").Select
    >> Range("A1").Select
    >> ActiveSheet.Paste
    >> Range("A1").Select
    >> ActiveWorkbook.Save
    >> Sheets("Control").Select
    >> Application.ScreenUpdating = True
    >> MsgBox " Finished, Exit EXCEL and open the ACCESS file to view
    >> Report "
    >> End Sub
    >> -------
    >> The sensor file name is named different every day and the user has to
    >> change the name before running the code. Of course half of them
    >> forget
    >> to. The file contents of the file are the same except the changes for
    >> the test data so it just the (set) name im trying to make easier.
    >> Or maby a code that will change the name for them, maby.
    >>
    >> Thank you,
    >> Pat
    >>
    >>
    >>
    >>
    >>
    >>
    >>
    >>
    >>
    >> JulieD Wrote:-
    >> Hi
    >>
    >> it would probably help if we could see the code, if you'ld like to
    >> copy
    >> &
    >> paste it (or at least the bit where the file name is referenced) in a
    >> reply
    >> this would give us a starting point ...
    >> and also to know where you run the code from - is it stored in
    >> personal
    >> and
    >> run via tools / macro / macros in the newly created workbook or ??
    >>
    >> Cheers
    >> JulieD
    >>
    >>
    >> "jenkinspat" [email protected] wrote in
    >> message
    >> news:[email protected]
    >>
    >> Hi all and thanks in advance for any help.
    >>
    >> I have excel workbooks that are produced on a daily bases by another
    >> program. The data layout is the same for each day produced except for
    >> the file name. What im having to do now is rename the file every day
    >> and then run my other code to clean it up and import the data into my
    >> new workbook.
    >> The code that i use works great but would like to be able to fix it
    >> so
    >> it doesn't matter what the file name is, so that others won't have to
    >> remember to change the name before they run the cleanup code. Any
    >> ideas.
    >> Thanks, Pat
    >>
    >>
    >> --
    >> jenkinspat--
    >>
    >>
    >> --
    >> jenkinspat-

    >
    >
    > --
    > jenkinspat




+ 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.6.0 RC 1