Solved

Can't run Word Application using shell in VB6.5

Posted on 2014-02-02
6
1,082 Views
Last Modified: 2014-02-03
Running Vista Home Premium and Access 2003

I have Microsoft Office Word 2007 on my desktop and it runs successfully. Using the search function in my OS I can't find the Microsoft Word executable for path in the shell function. I have tried using the shortcut from my desktop without success. Am I missing something about using the shell function to open up the application?  I've tried the following Code without success:

Path = "C:\Program Files\Microsoft Office\Office\winword.exe"
( a guess at where .exe file might be)

Path = "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft Office\Microsoft Office Word 2007"
(from my shortcut property)

Test = Shell (Path, vbNormalFocus)
0
Comment
Question by:fefifo99
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 51

Expert Comment

by:Rgonzo1971
ID: 39828829
Hi,

pls try

c:\program files\microsoft office\office12\winword.exe

Regards
0
 

Author Comment

by:fefifo99
ID: 39829876
Thanks, I found it but the application still doesn't open up although I can run the .exe file directly using explorer. My Shell code looks ok, what else do I need?
0
 
LVL 51

Expert Comment

by:Rgonzo1971
ID: 39829944
Hi,

Wouldn't be easier to use the Automation

Set oWord = CreateObject("Word.Application")
oWord.Visible = True

Open in new window

Regards
0
Webinar: Choosing a MySQL HA Solution

Join Percona’s Principal Technical Services Engineer, Marcos Albe as he presents Choosing a MySQL High Availability Solution on Thursday, June 29, 2017 at 10:00 am PDT / 2:00 pm EDT (UTC-7).

 

Author Comment

by:fefifo99
ID: 39830078
Great, that opens the application to the task bar. What code do I then use to open the file and display in an open window?
0
 
LVL 51

Accepted Solution

by:
Rgonzo1971 earned 500 total points
ID: 39830112
Hi,

pls look at this as example

Set WDApp = CreateObject("Word.Application")
 WDApp.Visible = True
 Set WDDoc = WDApp.Documents.Open("C:\FolderName\FileName.doc")

'or create a new document
' Set WDDoc = WDApp.Documents.Add

 With WDDoc

' YourCode

 .SaveAs ("C:\Foldername\NewDoc.doc")
 .Close ' close the document
 End With
 WDApp.Quit ' close Word
 Set WDDoc = Nothing
 Set WDApp = Nothing
 End Sub

Open in new window

0
 

Author Closing Comment

by:fefifo99
ID: 39831682
Thanks a million, suggestion of alternate code works!!
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question