Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / November 2004

Tip: Looking for answers? Try searching our database.

Using VBA via ActiveX?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sparky191 - 09 Nov 2004 11:59 GMT
Are there any issues to be aware of in running VBA via ActiveX controls,
and creating docs from webpages etc.

---
Message posted from http://www.ExcelForum.com/
Malcolm Smith - 10 Nov 2004 06:43 GMT
Yes

1.  Don't use the ActiveDocument pointer.   Instead grab hold of the
document pointer when you create or open a document and use that.

2.  Don't use early binding.  Use late binding.

These are the first two which spring to mind.

- Malc
Pete Bennett - 10 Nov 2004 15:39 GMT
3.  Use an error trap to make sure that Excel (I assume that's what you're
automating) is actually installed before you start doing anything serious
(just a simple on error trap just after you perform the CreateObject should
do it).

4.  Make sure there aren't any dialogs open in Excel that could mess up your
Automation.

This is the check I use in Word...

Private Function IsWordAvailable(oWord As Word.Application) As Boolean
Dim lngAddinCount As Long
On Error GoTo ErrHandler
IsWordAvailable = True

lngAddinCount = oWord.AddIns.Count
On Error GoTo 0
Exit Function
ErrHandler:
MsgBox "There appears to be a dialog box open in Word." & vbCr & vbCr & "You
should close down any open dialog screens before attempting to create a
document.", vbInformation, "Automation Error"
IsWordAvailable = False
On Error GoTo 0
End Function

> Yes
>
[quoted text clipped - 6 lines]
>
> - Malc
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.