Solved

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

Posted on 2014-02-02
6
1,060 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 49

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 49

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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 

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 49

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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

As technology users and professionals, we’re always learning. Our universal interest in advancing our knowledge of the trade is unmatched by most industries. It’s a curiosity that makes sense, given the climate of change. Within that, there lies a…
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

803 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