#1   Report Post  
Posted to microsoft.public.excel.misc
Kev Kev is offline
external usenet poster
 
Posts: 46
Default Locate Workbook

Hi to all you nice GURU's who have helped me SO much. First of all, Thank You.
Now to my question;
I have a workbook that stores "data" into another workbook, then hides the
"data" workbook. All works well with this macro;

Sub testmove1()
'
' testmove1 Macro
'
'
Range("I5:I7").Select
Selection.Copy
Workbooks.Open Filename:= _
"C:\Documents and Settings\Kev\Desktop\HyVee\Project\BOtestdata.xls"
Windows("BOtestdata.xls").Activate
Range("K1").Select
ActiveSheet.Paste
ActiveWindow.Visible = False
Range("E12").Select
End Sub
My problem is I'm building this at home for the office. When I transfer this
to my office, how to I "without having to "remake the macro", find the data
workbook.
I have it in the same dir as the source but the only way I can get it to
work is as in the code above.
Thank You
--
....kev...
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,726
Default Locate Workbook

Use GetOpenFilename

Sub testmove1()
Dim sFilename As String
Dim oWBTarget As Workbook
Range("I5:I7").Copy
sFilename = Application _
.GetOpenFilename("Microsoft Excel Files (*.xls), *.xls")
If sFilename < False Then
Set oWBTarget = Workbooks.Open(Filename:=sFilename)
oWBTarget.Activate
Range("K1").Select
ActiveSheet.Paste
ActiveWindow.Visible = False
Range("E12").Select
End If
End Sub


--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"kev" wrote in message
...
Hi to all you nice GURU's who have helped me SO much. First of all, Thank
You.
Now to my question;
I have a workbook that stores "data" into another workbook, then hides the
"data" workbook. All works well with this macro;

Sub testmove1()
'
' testmove1 Macro
'
'
Range("I5:I7").Select
Selection.Copy
Workbooks.Open Filename:= _
"C:\Documents and Settings\Kev\Desktop\HyVee\Project\BOtestdata.xls"
Windows("BOtestdata.xls").Activate
Range("K1").Select
ActiveSheet.Paste
ActiveWindow.Visible = False
Range("E12").Select
End Sub
My problem is I'm building this at home for the office. When I transfer
this
to my office, how to I "without having to "remake the macro", find the
data
workbook.
I have it in the same dir as the source but the only way I can get it to
work is as in the code above.
Thank You
--
...kev...



  #3   Report Post  
Posted to microsoft.public.excel.misc
Kev Kev is offline
external usenet poster
 
Posts: 46
Default Locate Workbook

Thanks a Mil...
Works like a charm :)
--
....kev...


"Bob Phillips" wrote:

Use GetOpenFilename

Sub testmove1()
Dim sFilename As String
Dim oWBTarget As Workbook
Range("I5:I7").Copy
sFilename = Application _
.GetOpenFilename("Microsoft Excel Files (*.xls), *.xls")
If sFilename < False Then
Set oWBTarget = Workbooks.Open(Filename:=sFilename)
oWBTarget.Activate
Range("K1").Select
ActiveSheet.Paste
ActiveWindow.Visible = False
Range("E12").Select
End If
End Sub


--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"kev" wrote in message
...
Hi to all you nice GURU's who have helped me SO much. First of all, Thank
You.
Now to my question;
I have a workbook that stores "data" into another workbook, then hides the
"data" workbook. All works well with this macro;

Sub testmove1()
'
' testmove1 Macro
'
'
Range("I5:I7").Select
Selection.Copy
Workbooks.Open Filename:= _
"C:\Documents and Settings\Kev\Desktop\HyVee\Project\BOtestdata.xls"
Windows("BOtestdata.xls").Activate
Range("K1").Select
ActiveSheet.Paste
ActiveWindow.Visible = False
Range("E12").Select
End Sub
My problem is I'm building this at home for the office. When I transfer
this
to my office, how to I "without having to "remake the macro", find the
data
workbook.
I have it in the same dir as the source but the only way I can get it to
work is as in the code above.
Thank You
--
...kev...




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
LINKEDRANGE function - a complement to the PULL function (for getting values from a closed workbook) [email protected] Excel Worksheet Functions 0 September 5th 06 03:44 PM
excel exits unexpectedly or hangs the second time I open workbook r_m_i Excel Discussion (Misc queries) 0 February 9th 06 10:14 PM
Repost:Automatically inserting a row in external workbook 50pingviner Excel Discussion (Misc queries) 3 December 28th 05 07:38 PM
keeping a toolbar attached to a workbook Paul Ponzelli Excel Discussion (Misc queries) 0 August 12th 05 11:39 PM
How to hyperlink from a workbook to sheets in another workbook? MJOHNSON Excel Worksheet Functions 0 February 17th 05 08:31 PM


All times are GMT +1. The time now is 08:33 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"