Solved

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

Posted on 2014-02-02
6
1,042 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
  • 3
  • 3
6 Comments
 
LVL 48

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 48

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
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 

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 48

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
Read about achieving the basic levels of HRIS security in the workplace.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

757 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now