Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Beginning VB 6
|
Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 20th, 2004, 11:14 AM
mlm mlm is offline
Registered User
 
Join Date: Jul 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Relative path for opening templates on a cd-rom ??

I am quite new to vba programming, but desided that trying is the best way to learn, turns out to our project got more complicated than expecten and because of that I have the following problem

We are having a .dot file which is to open other templates. This is the code that we are using to open the other templates:

Sub letterofcomplaint()
'
' Letterofcomplaint Makro
' Makro indspillet 16-03-2004 af Lars Gravesen
'
    Documents.Add Template:= _
        "C:\letter_transplate\Breve\letter_complaint.d ot" _
        , NewTemplate:=False, DocumentType:=0
End Sub



As you can see we are using a full path for the templates (c:\letter.........). The reason that we are using the full path is that we are having problems when using the relative path for opening the templates. Here is what happens.

When we use the relative path we can open the templates and this works fine BUT. But when we opens a template and then inserts some sentences through a macro integrated in the templates the problems comes. Beneath is the code for inserting text

Sub Jegskriverforatklage()
'
     Selection.TypeText Text:= _
        "I am writing to complain about the late delivery of our order we/345. "
        Selection.Comments.Add Range:=Selection.Range
Selection.TypeText Text:="Jeg skriver for at klage over den sene levering af vores ordre we/345."
ActiveWindow.ActivePane.

End sub

When we have inserted a sentence or used a macro in the template and use our original template and wants to opens other templates the path does not work any more it is like the apth is broken and the template can't find the other templates.
The relative path that we are using to open the other templates are the following.

Sub Hovedbrev()
'

    Documents.Add Template:= _
        ".\start.dot" _
        , NewTemplate:=False, DocumentType:=0
End Sub



Can anyone give us any ideas for what we are doing wrong and perhaps how to solve this problem.

The reason that we want the relative path to the other templates are that all templates are placed on a cd rom and therefore we don't know what drive letter their computer are using.

Hope that you can understand our little problem and any help are more than welcome. :-)

Thanks

mlm







Similar Threads
Thread Thread Starter Forum Replies Last Post
Access 2002 VBA CD-ROM rmccamont Access VBA 2 May 7th, 2004 09:22 PM
DeleteFile(filespec) with relative path? brandon1974 Classic ASP Basics 1 July 19th, 2003 04:58 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.