Does anybody know how to launch a word document using visual basic code?
any help would be greatly appreciated.
Printable View
Does anybody know how to launch a word document using visual basic code?
any help would be greatly appreciated.
It's been a while, but i think it goes like this:
Code:dim thedoc as object
set thedoc = CreateObject("Word.Application")
thedoc.Documents.Open FileName:="c:\urfile.doc"
thedoc.Visible = True
thedoc.Active
using the shellexecute function should work too !!
you might need to declare some stuffCode:ShellExecute hwnd, "open", "c:\the\word_file.doc", vbNullString, vbNullString, SW_SHOW
Code:Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Private Const SW_SHOW = 5
Only one problem with this code:Quote:
Originally posted here by hiddeninclouds
It's been a while, but i think it goes like this:
Code:dim thedoc as object
set thedoc = CreateObject("Word.Application")
thedoc.Documents.Open FileName:="c:\urfile.doc"
thedoc.Visible = True
thedoc.Active
thedoc.Active
should be changed to
thedoc.Activate
Later,
mjk
Thank you mjk and the jinx , your help is greatly appreciated, i will be trying each of your codes and will get back to you on what works and what didnt,
Thanks again!