More info is better

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Thanks for more information.

The previous answer solved most of my problem, but this explains corrective
action for the other things I can do wrong.

Thanks

Doug




"Someone" <nobody@xxxxxxx> wrote in message
news:rd3Xe.42490$ct5.13879@xxxxxxxxxxxxx
> At startup, you could execute these commands to switch the current path to
> where your App is:
>
> ChDrive App.Path
> ChDir App.Path
>
>
> It's not enough to use "ChDir App.Path", because that doesn't switch the
> current drive. It changes the path in the drive where the EXE is in, but
it
> doesn't change the drive. If your App is at "C:\MyApp\MyApp.exe", and the
> current path is "D:\", then after "ChDir App.Path", the current path is
> still "D:\".
>
> To get the current path in VB, use the following:
>
> Debug.Print CurDir
>
> In DOS(and Windows), there is a current drive, and a current path for each
> drive. The current path in the current drive is simply called the current
> path. Changing the path for the non-current drive does not change the
> current drive, so the current path stays the same.
>
> For an example, here are some commands I used in Command Prompt and their
> results(I have Windows XP and the CD is the OS CD):
>
> C:\WINDOWS>d:
> D:\>cd c:\windows\system32
> D:\>c:
> C:\WINDOWS\system32>d:
> D:\>cd i386
> D:\I386>c:
> C:\WINDOWS\system32>d:
> D:\I386>cd c:\windows
> D:\I386>c:
> C:\WINDOWS>cd c:\windows\system32
> C:\WINDOWS\system32>
>
> Finally, it's better to use a string variable instead of App.Path. If the
> user put your EXE in the root folder of C: drive, App.Path would return
> "C:\". If the user put the EXE in a subfolder, App.Path would return
> "C:\SomeFolder". There is no trailing backslash in the last one. Instead
of
> this, use the following:
>
> Public AppPath As String
>
> AppPath = App.Path
> If Right(AppPath, 1) = "\" Then
> ' Truncate the last "\"
> AppPath = Left(AppPath, Len(AppPath) - 1)
> End If
>
> When opening a file, use the following:
>
> Open AppPath & "\Somefile.txt" For Input As #f1
>
> If you have used App.Path above, and the EXE is in "C:\", the file name
> would be "C:\\Somefile.txt", which would generate a runtime error.
>
> Note that the Open statement above does not care what the current path is,
> so it's not important in this case. If your Open statement is like the
> following, then it does matter:
>
> Open "Somefile.txt" For Input As #f1
>
>
>
> "Doug Sanders" <DougS@xxxxxxxxxxxxx> wrote in message
> news:%23$gl370uFHA.3548@xxxxxxxxxxxxxxxxxxxxxxx
> >I don't do a lot of VB programming, here's the problem.
> >
> > I've developed a working project that loads documents and files on
demand.
> > These are all in my project folder on the 'C' drive.
> >
> > How do I refer to these files when all this is burned onto a CD ROM
where
> > I
> > won't know the client's CD drive letter.
> >
> > Hope I explained tis well.
> >
> > Thanks,
> >
> > Doug.
> >
> >
>
>


.



Relevant Pages

  • Re: Word Doc as Email Message Body?
    ... "Tony Jollans" wrote: ... Microsoft Word MVP ... What happens when you try to do what Doug suggests? ... recipient" not in the "All Commands" list? ...
    (microsoft.public.word.docmanagement)
  • Re: Word 97 document/data source to Word 2003
    ... Doug Robbins - Word MVP ... >>> Probably your best way is to restore the Mailmerge Helper that you were ... select Customize and then select the ... >>> Commands tab in the Customize dialog. ...
    (microsoft.public.word.mailmerge.fields)
  • Re: Word Doc as Email Message Body?
    ... Microsoft Word MVP ... "Tony Jollans" wrote: ... What happens when you try to do what Doug suggests? ... recipient" not in the "All Commands" list? ...
    (microsoft.public.word.docmanagement)
  • Re: Word Doc as Email Message Body?
    ... Whilst nothing would totally surprise me it seems much more likely that Dell ... What happens when you try to do what Doug suggests? ... You will find it in either the Commands Not in the Ribbon or the ... the Word doc into a blank email and send. ...
    (microsoft.public.word.docmanagement)
  • Re: Sending E-Mail
    ... Before the Open statement, you need ... Oops! ... Thanks Doug. ...
    (microsoft.public.access.formscoding)