Remember Me?
Menu
Home
Search
Today's Posts
Home
Search
Today's Posts
ExcelBanter
»
Excel Newsgroups
»
Excel Discussion (Misc queries)
>
Desperate I know I asked before
Reply
LinkBack
Thread Tools
Search this Thread
Display Modes
#
1
jenkinspat
Posts: n/a
Desperate I know I asked before
Thank you Nick,
Maby there is a god..... lol
Worked like a charm.
Wish i could return favor.....
Thank u,
Pat
Nick Hodge Wrote:
Pat
You should be able to just get the workbook name like so
Sub ExtractLatData()
'
'
Dim sWbName as String
Sheets("stby").Select
Application.ScreenUpdating = False
sWbName = Application.GetOpenFileName()
Workbooks.Open Filename:=sWbName
Sheets("RSR Summary").Select
....Rest of code
--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
HIS
"jenkinspat"
wrote in
message
. ..-
Looking for the excel god that can tell me Im an ideot and that this
isn't as hard as I'm making it. If its possiable at all. Ill try to
explain.
I work in Oil Exploration and we have whats called a recorder that
tests our euipment on the ground and produces test results every time
a
test is run. When the tests are done it creates an excel workbook
with
the results. The generated workbook layout is exactly the same, the
only difference is the file name that is created when produced. What
i
do is keep these workbooks and extract certain data out of them and
compile a tracking log in another workbook. The only problem is that
my
kindergarden code ;) requires me to rename the file before i can run
it.
My goal is:
To achive the generated report in a certain folder leaving the
generated name the same but be able to open any given file and run
the
clean up and extract code without the user having to rename it all
the
time.
I know i babbling but this has been a thorn in by kaboos for months.
ANY idea or alternates would be worth a zillion cyber dollars LOL.
Current code is----
Im using simple Excel code in a Module attached to a button
-----
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
--
jenkinspat-
--
jenkinspat
Reply With Quote
Reply
Thread Tools
Search this Thread
Show Printable Version
Search this Thread
:
Advanced Search
Display Modes
Linear Mode
Switch to Hybrid Mode
Switch to Threaded Mode
Posting Rules
Smilies
are
On
[IMG]
code is
On
HTML code is
Off
Trackbacks
are
On
Pingbacks
are
On
Refbacks
are
On
Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
Desperate I know I asked before
jenkinspat
Excel Discussion (Misc queries)
1
March 3rd 05
09:58 PM
All times are GMT +1. The time now is
11:16 AM
.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
Contact Us
ExcelBanter forum home
Privacy Statement
LinkBack
LinkBack URL
About LinkBacks