Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Help with path in VBA


Hi all

I have the following macro (still learning writing in code)
I would like the red highlighted path to be entered via a cell or input
box??
Please suggest something simple for me to understand. THX in advance.

Sub Transfer()
'
' Transfer Macro
' Macro recorded 31/07/2005 by Mike Colvin
'
Application.ScreenUpdating = False
Sheets("Transfer").Select
Range("B2:R38").Select
Selection.Copy

Workbooks.Open Filename:="\\Fsmel01\fireworks\6- Quality\Business
Division Quality\Technical Support\Amazon\Amanda Hicks\Call
Quality\Data\Data.xls"
Range("B2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Range("A1").Select
ActiveWorkbook.Save
ActiveWindow.Close
ActiveWindow.ScrollWorkbookTabs Position:=xlFirst
Range("A38").Select
Sheets("Transfer").Select
Range("B2:R38").Select
Application.CutCopyMode = False
Selection.ClearContents
Range("A1").Select
Sheets("Menu").Select
Range("A1").Select
Application.ScreenUpdating = True
MsgBox "Transfer Complete" & vbNewLine & "" & vbNewLine & "REMEMBER
TO SAVE & CLOSE"

'
End Sub


--
Mikeice
------------------------------------------------------------------------
Mikeice's Profile: http://www.excelforum.com/member.php...o&userid=22467
View this thread: http://www.excelforum.com/showthread...hreadid=397221

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Help with path in VBA

I don't see anything highlighted in red, but to substitute in the string you
could use something like:

v = Range("A1").Value
or
v = InputBox("Enter Path")

if Right(v,1) < "\" then v = v & "\"
Workbooks.Open Filename:= v & Data.xls"

--
Regards,
Tom Ogilvy


"Mikeice" wrote in
message ...

Hi all

I have the following macro (still learning writing in code)
I would like the red highlighted path to be entered via a cell or input
box??
Please suggest something simple for me to understand. THX in advance.

Sub Transfer()
'
' Transfer Macro
' Macro recorded 31/07/2005 by Mike Colvin
'
Application.ScreenUpdating = False
Sheets("Transfer").Select
Range("B2:R38").Select
Selection.Copy

Workbooks.Open Filename:="\\Fsmel01\fireworks\6- Quality\Business
Division Quality\Technical Support\Amazon\Amanda Hicks\Call
Quality\Data\Data.xls"
Range("B2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Range("A1").Select
ActiveWorkbook.Save
ActiveWindow.Close
ActiveWindow.ScrollWorkbookTabs Position:=xlFirst
Range("A38").Select
Sheets("Transfer").Select
Range("B2:R38").Select
Application.CutCopyMode = False
Selection.ClearContents
Range("A1").Select
Sheets("Menu").Select
Range("A1").Select
Application.ScreenUpdating = True
MsgBox "Transfer Complete" & vbNewLine & "" & vbNewLine & "REMEMBER
TO SAVE & CLOSE"

'
End Sub


--
Mikeice
------------------------------------------------------------------------
Mikeice's Profile:

http://www.excelforum.com/member.php...o&userid=22467
View this thread: http://www.excelforum.com/showthread...hreadid=397221



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Help with path in VBA


If I not misunderstood you, I think you can use a variable here.

For example:

Dim strFilePath as string

strFilePath = inputbox("Enter File Path here") 'from input box

or

strFilePath = Cells(1,"B").value 'from cell value


Then use that variable in your workbook.open method:

Workbook.open Filename:=strFilePath


--
hideki
------------------------------------------------------------------------
hideki's Profile: http://www.excelforum.com/member.php...o&userid=18903
View this thread: http://www.excelforum.com/showthread...hreadid=397221

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
File Path Too Long? Not Anymore! Check out Long Path Tool Max Loger Excel Discussion (Misc queries) 1 March 24th 17 07:59 AM
Formula too long - new file path is shorter than old file path - Excel 2003 Greg J Excel Worksheet Functions 1 November 22nd 06 05:16 PM
hyperlink navigation path path wrong in Excel 2003 CE Admin Excel Discussion (Misc queries) 5 January 7th 06 07:47 PM
how to change absolute path to relative path hwijgerse Excel Worksheet Functions 0 November 25th 05 07:18 AM
Current path to Qualified Path Mary Excel Programming 1 October 14th 04 02:42 PM


All times are GMT +1. The time now is 12:22 PM.

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

About Us

"It's about Microsoft Excel"