Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1151
  • Last Modified:

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

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
fefifo99
Asked:
fefifo99
  • 3
  • 3
1 Solution
 
Rgonzo1971Commented:
Hi,

pls try

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

Regards
0
 
fefifo99Author Commented:
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
 
Rgonzo1971Commented:
Hi,

Wouldn't be easier to use the Automation

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

Open in new window

Regards
0
Improve Your Query Performance Tuning

In this FREE six-day email course, you'll learn from Janis Griffin, Database Performance Evangelist. She'll teach 12 steps that you can use to optimize your queries as much as possible and see measurable results in your work. Get started today!

 
fefifo99Author Commented:
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
 
Rgonzo1971Commented:
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
 
fefifo99Author Commented:
Thanks a million, suggestion of alternate code works!!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Improve Your Query Performance Tuning

In this FREE six-day email course, you'll learn from Janis Griffin, Database Performance Evangelist. She'll teach 12 steps that you can use to optimize your queries as much as possible and see measurable results in your work. Get started today!

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now