View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Zlord Zlord is offline
external usenet poster
 
Posts: 1
Default Set MyPath variable as workbook.path


The code for this is below.
I simply want to set the variable MyPath as the directory that th
workbook was opened from.

I'm coding this macro in VB

Thanks in advance for the help.


Code
-------------------

Dim basebook As Workbook
Dim mybook As Workbook
Dim sourceRange As Range
Dim destrange As Range
Dim SourceRcount As Long
Dim N As Long
Dim rnum As Long
Dim MyPath As String
Dim SaveDriveDir As String
Dim FName As Variant
Dim rng As Range
Dim stng As Long
stng = 3

MsgBox "Please Wait, as this can take some time", vbOKOnly + vbCritical

SaveDriveDir = CurDir
MyPath = ThisWorkbook.Path

ChDir MyPath
Set rng = Range("A1:IV1")
rng.ClearContents
Set rng = Range("A3:IV5005")

-------------------

--
Zlor
-----------------------------------------------------------------------
Zlord's Profile: http://www.excelforum.com/member.php...fo&userid=2751
View this thread: http://www.excelforum.com/showthread.php?threadid=47032