Click here to Skip to main content
15,889,116 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralForms display Pin
Member 109674913-May-04 9:31
Member 109674913-May-04 9:31 
GeneralRe: Forms display Pin
Dave Kreskowiak13-May-04 11:50
mveDave Kreskowiak13-May-04 11:50 
QuestionImage problem??? Pin
Small Rat13-May-04 9:24
Small Rat13-May-04 9:24 
GeneralKodak AxImgEditLibCtl question Pin
kowplunk13-May-04 7:57
kowplunk13-May-04 7:57 
GeneralRe: Kodak AxImgEditLibCtl question Pin
kowplunk13-May-04 8:01
kowplunk13-May-04 8:01 
GeneralMicrosoft Outlook 9.0 Object Library Pin
Brent Lamborn13-May-04 6:00
Brent Lamborn13-May-04 6:00 
GeneralRe: Microsoft Outlook 9.0 Object Library Pin
Dave Kreskowiak13-May-04 6:57
mveDave Kreskowiak13-May-04 6:57 
GeneralRe: Microsoft Outlook 9.0 Object Library Pin
xfitr214-May-04 7:42
xfitr214-May-04 7:42 
I had this same problem with using the WORD and EXCEL object libraries. The following example I'll use is with WORD, but you can modify it for your own project.

Dim wA as Object<br />
Dim WordWasNotRunning as Boolean<br />
<br />
Sub Test()<br />
   On Error Resume Next<br />
   Set wA = GetObject(, "Word.Application")<br />
   If Err Then<br />
      Set wA = CreateObject("Word.Application")<br />
      WordWasNotRunning = True<br />
   End If<br />
   On Error Goto 0<br />
<br />
   <<Insert Code Here>><br />
<br />
   If WordWasNotRunning then wA.Quit<br />
   Set wa = Nothing<br />
End Sub


This code creates an object and then by using the GetObject/CreateObject opens whichever object library is installed on the machine. The boolean is so that you do not close the Word application if they already had it opened with another document, if you don't do it this way, then you will leave multiple WinWord.exe processes running on the machine and your program will crash after you have initialized it at least once. (MAKE SURE YOU DESTROY THE OBJECTS!!)

HINT:
Design your program first by loading the object libraries for Office so you can debug the program and get the helpful dropdown menus. Then before you compile it, change the code to the code on top and get rid of the library References. I also found out that older versions of office do not use the same constants (i.e. wdStory, etc.), so use the actual values like '6'. Hope that helps.

-Garrett
GeneralRe: Microsoft Outlook 9.0 Object Library Pin
Brent Lamborn14-May-04 15:19
Brent Lamborn14-May-04 15:19 
GeneralVB.NET Excell Cell Formatting Pin
CSHighCommand13-May-04 5:08
CSHighCommand13-May-04 5:08 
GeneralRe: VB.NET Excell Cell Formatting Pin
Dave Kreskowiak13-May-04 6:54
mveDave Kreskowiak13-May-04 6:54 
GeneralRe: VB.NET Excell Cell Formatting Pin
John Kuhn13-May-04 14:53
John Kuhn13-May-04 14:53 
GeneralRe: VB.NET Excell Cell Formatting Pin
Dave Kreskowiak14-May-04 0:03
mveDave Kreskowiak14-May-04 0:03 
GeneralRe: VB.NET Excell Cell Formatting Pin
mattfc14-May-04 9:09
mattfc14-May-04 9:09 
GeneralFind in Word Pin
RichardGrimmer13-May-04 2:54
RichardGrimmer13-May-04 2:54 
GeneralRe: Find in Word Pin
RichardGrimmer13-May-04 2:58
RichardGrimmer13-May-04 2:58 
GeneralDataCombo/List in VB6 Pin
Larry Gatlin13-May-04 2:33
professionalLarry Gatlin13-May-04 2:33 
GeneralRe: DataCombo/List in VB6 Pin
Dave Kreskowiak13-May-04 6:53
mveDave Kreskowiak13-May-04 6:53 
GeneralRe: DataCombo/List in VB6 Pin
Larry Gatlin13-May-04 13:36
professionalLarry Gatlin13-May-04 13:36 
GeneralOffice Addin IDTExtensibility2 Event Pin
shinay12-May-04 20:02
shinay12-May-04 20:02 
GeneralRe: Office Addin IDTExtensibility2 Event Pin
Anonymous12-May-04 23:19
Anonymous12-May-04 23:19 
QuestionHow can I ignore invalide path characters being entered into a text box Pin
Kettlewell12-May-04 13:17
Kettlewell12-May-04 13:17 
QuestionHow can I get the event when user using DELETE key to delete a ROW of a datagid table? Pin
ATC12-May-04 11:05
ATC12-May-04 11:05 
AnswerRe: How can I get the event when user using DELETE key to delete a ROW of a datagid table? Pin
shinay12-May-04 19:57
shinay12-May-04 19:57 
GeneralRe: How can I get the event when user using DELETE key to delete a ROW of a datagid table? Pin
ATC31-May-04 8:28
ATC31-May-04 8:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.