Trouble finding my file location

  • Thread starter Thread starter John Wright
  • Start date Start date
J

John Wright

I have a program I am deploying that uses a Word template that I want to
deploy with the program. This is a template I use to populate and print.
I have included the word doc in my project but I cannot get the path the
file. I tried to use doc.open("docname.doc") but I get a path not found
error. I need to include the doc with the program because not all PC's have
network connection (but do have word). If I include the file in the project
what is the path?

John
 
I have a program I am deploying that uses a Word template that I want to
deploy with the program. This is a template I use to populate and print.
 I have included the word doc in my project but I cannot get the path the
file.  I tried to use doc.open("docname.doc") but I get a path not found
error.  I need to include the doc with the program because not all PC'shave
network connection (but do have word).  If I include the file in the project
what is the path?

John

Try adding docname.doc to application's folder (that is, your
application's root folder, aka projects output folder), then use
Application.Startuppath as follows:

Untested:
doc.open(Application.Startuppath & "\" & "docname.doc")

Hope this helps,

Onur Güzel
 
If you want it embedded in your executable, you can go to Project > [Name of
Project] Properties... > then click on the "Resources" tab. Add the document
as a resource and then in your code, use:

Doc.open(my.resources.dockname.doc)

That should work fine.

Hope that helps,
Ray
 
Back
Top