then how do I get it to work with the reference turned off. I get an object required error
then how do I get it to work with the reference turned off. I get an object required error
Probably because you have qualified it with the application object.
ok so how do I unqualify it?
I meant haven't not have.
I think Bob's saying you have to dim it as an object too...just as you did in this code for the email object:
[VBA]Dim OL As Object
Dim EmailItem As Object
Dim WB As Workbook
TurnOffFeatures
Set OL = CreateObject("Outlook.Application")
Set EmailItem = OL.CreateItem(0)
[/VBA]
Steve
"Nearly all men can stand adversity, but if you want to test a man's character, give him power."
-Abraham Lincoln
I was assuming he had already done that Steve, although I was thinking Word, and that he just needed to pre-pend Documents with that object variable.
so would this be what you mean
[VBA]dim Documents as object[/VBA]
Just trying to cover the bases Bob....I didn't see in his previous code where he had dealt with the Word object so I thought I would remind him of the concept...not meaning to step on toes.
Steve
"Nearly all men can stand adversity, but if you want to test a man's character, give him power."
-Abraham Lincoln
Nor did I Steve, he hasn't mentioned it specifically, hence my obtuseness borne of lack of information.
Reading between the lines in not my best suite. It seems they think we can look over thier shouders somtimes and see what they are doing.....
Several regular supporters here have signatures that refer to complete descriptions of what your trying to do but if you don't get the info you have to work in the dark.....time consuming and frustrating.
Steve
"Nearly all men can stand adversity, but if you want to test a man's character, give him power."
-Abraham Lincoln
No, no!Originally Posted by Djblois
Letr's assume, because you haven't told me, that you have started word from your code and have a Word object. Let us further assume that that object is called oWord (spooky stuff!).
IF these assumptions are correct, you probably want
oWord.Documents.Open (blah blah blah)
no I haven't started word yet but I guess I need to?
How do I start word programatically?
create object....just as you did with outlook..
Steve
"Nearly all men can stand adversity, but if you want to test a man's character, give him power."
-Abraham Lincoln
You do if you are working with Word documnts. Are you sure that is what you need?Originally Posted by Djblois
THis is what I have now and it is I think opening the file hidden:
[VBA]Sub Instructions()
Set WD = CreateObject("Word.Application")
TurnOffFeatures
On Error Resume Next
WD.Documents.Open ("H:\@Business_Reporting_Today\References\Business Reporting Today.doc")
TurnOnFeatures
End Sub[/VBA]
I think that because it doesn't show the first time I run it and if I run it again it says it is locked for editing by me.
Add
WD.Visible = True
after creating the Word instance.
that works perfectly but now I want to create it so it checks if it is open already and if it is already open then it will switch to it. I know how to do this with excel but not with word.
Same, just Word.Application not Excel.APplication.
PS when you go consulting I claim 10% of your income.