|
-
Jan 5th, 2004, 05:30 AM
#1
Thread Starter
Lively Member
GetObject
Help!!!!!!!
Until Friday everything worked fine. Today, nothing seems to work.
I'm using GetObject:
VB Code:
Dim objWordInstance As Word.Application
objWordInstance = GetObject(, "Word.Application")
Unfortunately after this objWordInstance is nothing even if I can see, that there is an instance of word. What might be wrong???
-
Jan 5th, 2004, 06:05 AM
#2
i put you a reply on dotnetforums.net , but here ya go.
you could try looking for instances of the word process ( WINWORD ) , then dimming the word app as an object when using getobject , then casting it to what it should be. eg:
VB Code:
Dim wordApp As Word.ApplicationClass
Dim p As Process() = Process.GetProcessesByName("WINWORD")
If Not p.Length = 0 Then
Dim objWord As Object = GetObject(, "Word.Application")
wordApp = DirectCast(objWord, Word.ApplicationClass)
'/// word application found and can be manipulated now.
Else
'/// no word app found running.
End If
~
if a post is resolved, please mark it as [Resolved]
protected string get_Signature(){return Censored;}
[vbcode][php] please use code tags when posting any code [/php][/vbcode]
-
Jan 5th, 2004, 06:48 AM
#3
Thread Starter
Lively Member
Sorry, but I don't think, that there would be any difference.
I changed nothing in my source code and since today, it doesn't work.
Maybe, it would work if I declared my variable objWordinstance not as Word.Application but as Object but I really would like to know why it doesn't work any more.
The way I'm trying it, I get an error
"specified cast is not valid".
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|