Solved

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

Posted on 2014-02-02
6
1,070 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 50

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 50

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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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 50

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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.
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

730 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