473,473 Members | 1,520 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

CurDir returns current directory one folder short

2 New Member
While using CurDir to get the current path where my open workbook is located, I get a result that's short of the current folder.e.g. the path to the file is C:\FolderLv1\FolderLv2\FolderLv3\Myfile.xls

And CurDir returns: C:\FolderLv1\FolderLv2

This creates a problem when trying to open the next xls file in the same folder.

Can anyone help?
Here is the code:

Private Sub ConsolidationButton_Click()
Dim strYear As String
Dim strMonth As String
Dim stCrurrentSite As String
Dim strFilePath As String
Dim strFileName As String



Dim consolidate_app As Object

' Create the Excel application.
Set consolidate_app = CreateObject("Excel.Application")

strYear = InputBox("Enter the Year in format YYYY:", "Monthly Consolidation")
strMonth = InputBox("Enter the Month in format MM:", "Monthly Consolidation")



strFilePath = CurDir()
MsgBox (strFilePath)
strFileName = "HR Input Sheet LNO.xls"
MsgBox (strFilePath & "\" & strFileName)

consolidate_app.Workbooks.Open (strFilePath & "\" & strFileName)
consolidate_app.Workbooks(strFileName).Activate
ActiveWorkbook.NewWindow


End Sub
Jul 9 '08 #1
0 1462

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: tornado | last post by:
Hi all, I am pretty new to PHP. I was reading PHP manual and trying out the example from 2nd chapter (A simple Tutorial). When i try to print the variable as given in the example it returns...
2
by: Dave | last post by:
In VB .Net I can get the current directory using the CurDir() function. Does C# have a similar function. Or how can I discover the current path in C#?
1
by: Lance | last post by:
Hi All, I change the current directory in a proc, using CurDir(). The change persists across executions. I would like the CurDir() return value to be the same at the start of each execution. Any...
6
by: Ian | last post by:
Can someone tell me what CurDir returns, I am trying to find the path to the Drive letter where Windows is installed on a PC, using code like: Function DriveLetter() Dim curdrv As String ...
3
by: Alur | last post by:
Changing the current directory with the help of dialog window(MFC app) We can change directory with the help of the following code: CFileDialog m_ldFile(TRUE);...
4
by: Elmo Watson | last post by:
Is there a way, with the System.IO class, to do a recursive list of a directory structure? For instance, in DirectoryInfo, you have GetDirectories and GetFiles .... In Directory, you have...
1
by: RAJ | last post by:
Hi, I am acccessing my crystal reports bundled version developed in VB.NET 2002. I stored my report in local C drive and set the report source as follows: rptPositiveMatch.ReportSource =...
5
by: GenCode | last post by:
What is the best way to read a "readable" web directory... I know I can do this Client.DownloadFile("http://www.mydomain.com/readabledir/", c:\ \dir.txt"); But that gives me the html and all...
8
by: Mateusz Viste | last post by:
Hi, I'm not sure if my question is really related to JavaScript, so please excuse me if that's not the case (and maybe you guys would have an idea what's the cause is and where could I ask)... ...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.