Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
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
  #1 (permalink)  
Old June 12th, 2003, 10:16 AM
Registered User
Join Date: Jun 2003
Location: , LA, .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Opening a .doc file for view

I have a variable named StrJobNum that i get from a list box that the user selects. On my hard drive are .doc files that each match one of the given selections from the list box. So what I need is for my program to then open the .doc files in word with something like "C:\My Documents\StrJobNum.doc" and I have each file for every given situation for StrJobNum. So if my StrJobNum is A1024, I want it to open C:\My Documents\A1204.doc in word, or if possible then make it splash up onto the screen. Thanks guys :) I wish i was smart enough but i haven't got there yet :(
  #2 (permalink)  
Old June 12th, 2003, 09:37 PM
Authorized User
Join Date: Jun 2003
Location: , , Japan.
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts

If you don't feel put off by the Win API (and you shouldn't be in this case) I'd say try ShellExexcute.

Details here http://vbaccelerator.nuwebhost.com/c...ll/shellex.htm or http://support.microsoft.com/default...en-us%3B170918 here.

If you still have problems are reading these post back.
  #3 (permalink)  
Old June 14th, 2003, 02:56 PM
Registered User
Join Date: Jun 2003
Location: Tucson, AZ, .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts

I found this code that opens it in Read Only mode, but I imagine you could change the attributes to make it editable:

Set WordApp = CreateObject("Word.Application")
    WordApp.Visible = True
    WordApp.Documents.Open ("C:\Temp\Test1.Doc")

Pete S - Tucson, AZ

Pete S - Tucson, AZ

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem opening Excel Doc when using AxBrowser sroy C# 2 September 19th, 2006 06:07 AM
Opening a doc file using a jsp karthik_talasu Javascript 3 June 27th, 2006 08:02 AM
Problem in opening .doc file kumar_raj13 C# 1 March 13th, 2006 12:57 PM
opening doc (in another server) thisgal1213 Classic ASP Basics 1 January 3rd, 2006 08:55 PM

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