|
-
Apr 5th, 2000, 02:17 AM
#1
Thread Starter
New Member
I receive an Object variable or With Block not set error sometimes when running the following code:
Function wordConversion(sFileName As String)
If wordApp Is Nothing Then
Set wordApp = CreateObject("word.Application")
End If
Set wordDoc = wordApp.Documents.Open(sFileName)
<<this is where the error gets highlighted>>
With Documents.Application.Selection
.WholeStory
.Font.Name = "Ariel"
.Font.Size = 9
End With
ActiveDocument.PageSetup.Orientation = wdOrientLandscape
sFileName = nameChange(sFileName)
ActiveDocument.SaveAs sFileName, wdFormatDocument
ActiveDocument.Close
Set wordDoc = Nothing
End Function
Any ideas why this error would occur only occasionally, and how to correct the problem?
Thanks
-
Apr 5th, 2000, 02:47 AM
#2
transcendental analytic
You get that "Object variable or With Block not set" error if the Documents.Application.Selection does not return any object. I don't know how to use word in vb but so I don't know but I think this Selection will return nothing if there isnt anything selected.
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
|