AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

MS Office Automation Functions (via COM) [thanks Sean]
Goto page 1, 2, 3, 4  Next
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  

Should this be continued?
Yes
93%
 93%  [ 14 ]
No
6%
 6%  [ 1 ]
Total Votes : 15

Author Message
ahklerner



Joined: 26 Jun 2006
Posts: 1205
Location: USA

PostPosted: Sat May 17, 2008 8:12 pm    Post subject: MS Office Automation Functions (via COM) [thanks Sean] Reply with quote

[I will make the post better later.. Smile ]
Tested on Office 2003 Pro

Requires COM.ahk
http://www.autohotkey.com/forum/viewtopic.php?t=22923

MS Word:
Test Script:
Code:
; WORD TEST SCRIPT
com_CoInitialize() ; Initialize COM

; File Name to be created / opened
FileName = test_word_document.doc

Word_Open() ; Opens a New Document
; Word_OpenDoc(FileName) ; Opens an existing document

;Set Initial Values
; They are toggled later
Bold    := True
Italic    := False
Caps    := True
FontSize = 4

Loop, 20
   {
   FontSize += 2 ; Increase the Font Size
   ; Set the Current Font
   ; Word_SetCurrentFont(Font,FontSize,Bold,Italic,Caps)
   Word_SetCurrentFont("Arial",FontSize,Bold := !Bold,Italic := !Italic,Caps := !Caps)
   Word_InsertText("abcdefg`n") ; Insert The Text
   }

MsgBox Going to save and exit.

;SaveAs DOES NOT PROMPT FOR OVERWRITE IF THE FILE NAME ALREADY EXISTS
Word_SaveAs(A_ScriptDir . "\" . FileName)
;Close Word
Word_Close()

com_CoUnInitialize()
exitapp


Code:
; **************************************************************************
; Author:   ahklerner
; Language:   AutoHotkey v1.0.47.06
; Creation Date:   05/19/2008   14:15
; Function Name:   Word_InsertText()
;
; Insert text into the current document at the insertion point or overwriting selected area
;
; Syntax:
;    Word_InsertText(Text)
; Parameters:
; 1)   Text   = the text string to insert into the document   
; Return:
;    Success = nothing
;    Failure = nothing
; **************************************************************************
Word_InsertText(Text){   
   Word := Word_Attach("A") ; Attach to Active Window
   Selection := com_invoke(Word,"Selection") ; Get Insertion Point or Selected text
   com_invoke(Selection,"TypeText", Text) ; Put the text there
   com_release(Selection) ; cleanup
   com_release(Word) ; cleanup
   }


; **************************************************************************
; Author:   ahklerner
; Language:   AutoHotkey v1.0.47.06
; Creation Date:   05/19/2008   14:16
; Function Name:   Word_Open()
;
; Start a new instance of word
;
; Syntax:
;    Word_Open()
; Parameters:
;   None
; Return:
;    Success = nothing
;    Failure = nothing
; **************************************************************************
Word_Open(){
   Word := Word_Attach("N") ; Attach to New Window
   Documents := com_Invoke(Word, "Documents")
   com_invoke(Documents,"Add") ;    Add a new document
   com_invoke(Documents,"Select") ; Select it
   com_release(Documents) ; cleanup
   com_release(Word) ; cleanup
   }


; **************************************************************************
; Author:   ahklerner
; Language:   AutoHotkey v1.0.47.06
; Creation Date:   05/19/2008   14:17
; Function Name:   Word_Close()
;
; Close all instances of word
; may prompt for save dialog.
;
; Syntax:
;    Word_Close()
; Parameters:
;   None
; Return:
;    Success = nothing
;    Failure = nothing
; **************************************************************************
Word_Close(){
   Word := Word_Attach("A") ; Attach to Active Window
   com_invoke(Word,"Quit")   ; quit all instances
   com_release(Word) ; cleanup
   }

; **************************************************************************
; Author:   ahklerner
; Language:   AutoHotkey v1.0.47.06
; Creation Date:   05/19/2008   14:18
; Function Name:   Word_SaveAs()
;
; Syntax:
;    Word_SaveAs(SaveFileName)
; Parameters:
; 1)   SaveFileName   = The name to save the file as. Must be Full Path   
; Return:
;    Success =
;    Failure =
; **************************************************************************
Word_SaveAs(SaveFileName){
   Word := Word_Attach("A") ; Attach to Active Window
   ActiveDocument := com_invoke(Word,"ActiveDocument") ; get the active document
   com_invoke(ActiveDocument,"SaveAs", SaveFileName, wdFormatDocument := 0) ; Save the file
   com_release(ActiveDocument) ; cleanup
   com_release(Word) ; cleanup
   }


; **************************************************************************
; Author:   ahklerner
; Language:   AutoHotkey v1.0.47.06
; Creation Date:   05/19/2008   14:18
; Function Name:   Word_Save()
;
; Save the current file
;
; Syntax:
;    Word_Save()
; Parameters:
;   None
; Return:
;    Success = nothing
;    Failure = nothing
; **************************************************************************
Word_Save(){
   Word := Word_Attach("A") ; Attach to Active Window
   ActiveDocument := com_invoke(Word,"ActiveDocument")
   com_invoke(ActiveDocument,"Save") ; save file
   com_release(ActiveDocument) ; cleanup
   com_release(Word) ; cleanup
   }

; **************************************************************************
; Author:   ahklerner
; Language:   AutoHotkey v1.0.47.06
; Creation Date:   05/19/2008   14:19
; Function Name:   Word_OpenDoc()
;
; Syntax:
;    Word_OpenDoc(FileName)
; Parameters:
; 1)   FileName   = The file name to open   
; Return:
;    Success = nothing
;    Failure = nothing
; **************************************************************************
Word_OpenDoc(FileName){
   Word := Word_Attach("N") ; Attach to New Window
   Documents := com_Invoke(Word, "Documents")
   com_invoke(Documents,"Open",FileName) ; open file
   com_release(Documents) ; cleanup
   com_release(Word) ; cleanup
   }


; **************************************************************************
; Author:   ahklerner
; Language:   AutoHotkey v1.0.47.06
; Creation Date:   05/19/2008   14:19
; Function Name:   Word_GetActiveTitle()
;
; Gets the title of the Active document
;
; Syntax:
;    Word_GetActiveTitle()
; Parameters:
;   None
; Return:
;    Success = The title of the active document
;    Failure = nothing
; **************************************************************************
Word_GetActiveTitle(){
   Word := Word_Attach("A") ; Attach to Active Window
   ActiveDocument := com_invoke(Word,"ActiveDocument")
   Name := com_invoke(ActiveDocument,"Name") ; get the document name
   com_release(ActiveDocument) ; cleanup
   com_release(Word) ; cleanup
   return Name
   }

;get document text


; **************************************************************************
; Author:   ahklerner
; Language:   AutoHotkey v1.0.47.06
; Creation Date:   05/19/2008   14:21
; Function Name:   Word_GetText()
;
; Get the text of the Active Document
;
; Syntax:
;    Word_GetText()
; Parameters:
;   None
; Return:
;    Success = The document text
;    Failure = nothing
; **************************************************************************
Word_GetText(){
   Word := Word_Attach("A") ; Attach to Active Window
   ActiveDocument := com_invoke(Word,"ActiveDocument")
   Range := com_invoke(ActiveDocument,"Range")
   DocText := com_invoke(Range,"Text") ; get the document text
   com_release(Range) ; cleanup
   com_release(ActiveDocument) ; cleanup
   com_release(Word) ; cleanup
   return DocText
   }

;Get selected text

; **************************************************************************
; Author:   ahklerner
; Language:   AutoHotkey v1.0.47.06
; Creation Date:   05/19/2008   14:21
; Function Name:   Word_GetSelection()
;
; Get the currently selected text in the active document
;
; Syntax:
;    Word_GetSelection()
; Parameters:
;   None
; Return:
;    Success = the currently selected text
;    Failure = nothing
; **************************************************************************
Word_GetSelection(){
   Word := Word_Attach("A") ; Attach to Active Window
   Selection := COM_Invoke(Word,"Selection")
   SelText := com_invoke(Selection,"Text") ; get the selected text
   com_release(Selection) ; cleanup
   com_release(Word) ; cleanup
   return SelText
   }



; **************************************************************************
; Author:   ahklerner
; Language:   AutoHotkey v1.0.47.06
; Creation Date:   05/19/2008   14:22
; Function Name:   Word_SetCurrentFont()
;
; Set the font of the selected text or the current font
;
; Syntax:
;    Word_SetCurrentFont(sFontName="Times New Roman",sFontSize="10",bBold=0,bItalic=0,bCaps=0)
; Parameters:
; 1)   sFontName="Times New Roman"   =    The name of the font to use
; 2)   sFontSize="10"   =    The font size
; 3)   bBold=0   =    True or False Bold
; 4)   bItalic=0   =    True or False Italic
; 5)   bCaps=0   =    True or False All Caps
; Return:
;    Success = nothing
;    Failure = nothing
; **************************************************************************
Word_SetCurrentFont(sFontName="Times New Roman",sFontSize="10",bBold=0,bItalic=0,bCaps=0){
   Word := Word_Attach("A") ; Attach to Active Window
   Selection := COM_Invoke(Word,"Selection")
   Font := COM_Invoke(Selection,"Font")
   COM_Invoke(Font,"Name=", sFontName) ; Font Name
   COM_Invoke(Font,"Size=", sFontSize) ; Font Size
   COM_Invoke(Font,"Bold=", bBold) ; Bold
   COM_Invoke(Font,"Italic=", bItalic) ; Italic
   COM_Invoke(Font,"AllCaps=", bCaps) ; Caps
   com_release(Font) ; cleanup
   com_release(Selection) ; cleanup
   com_release(Word) ; cleanup
   }

; **************************************************************************
; Author:   ahklerner
; Language:   AutoHotkey v1.0.47.06
; Creation Date:   05/19/2008   14:24
; Function Name:   Word_Detach()
;
; com_release wrapper for consistency
;
; Syntax:
;    Word_Detach(ObjWord)
; Parameters:
; 1)   ObjWord   =    Handle to already opened object
; Return:
;    Success = nothing
;    Failure = nothing
; **************************************************************************
Word_Detach(ObjWord){
   com_release(ObjWord)
   }


; **************************************************************************
; Author:   ahklerner
; Language:   AutoHotkey v1.0.47.06
; Creation Date:   05/19/2008   14:26
; Function Name:   Word_Attach()
;
; Gets the active Word Object or creates a new one
;
; Syntax:
;    Word_Attach(sInstance="A")
; Parameters:
; 1)   sInstance="A"   = Values:   
;                   A - Active Object - Default
;                   N - New Object
; Return:
;    Success = handle to a word object
;    Failure = Nothing
; **************************************************************************
Word_Attach(sInstance="A"){
   SetWinDelay, 0
   ;Get The Last Used Instance
   if (sInstance = "A") { ; Active
      ObjWord := COM_GetActiveObject("Word.Application")
      COM_Invoke(ObjWord,"Visible=",True)
      COM_Invoke(ObjWord,"Activate")
      }
   Else if (sInstance = "N") { ; New
      ObjWord := com_CreateObject("Word.Application")
      COM_Invoke(ObjWord,"Visible=",True)
      COM_Invoke(ObjWord,"Activate")
      }
   return ObjWord
   }
   


; **************************************************************************
; Author:   ahklerner
; Language:   AutoHotkey v1.0.47.06
; Creation Date:   05/19/2008   14:31
; Function Name:   Word_ObjGetHwnd()
;
; Gets the hWnd for a given Word object
;
; Syntax:
;    Word_ObjGetHwnd(hObj)
; Parameters:
; 1)   hObj   = Handle to word object
; Return:
;    Success = hWnd to hObj 's parent window
;    Failure = nothing
; **************************************************************************
Word_ObjGetHwnd(hObj){
   DetectHiddenWindows, On
   SetTitleMatchMode, 2
   ;http://support.microsoft.com/kb/310744
   ;Generate a unique title
   sCaption := "[" . UUID() . "]"
   ;set the title of the window
   com_invoke(hObj,"Caption=",sCaption)
   ;get the current caption
   sCaption := com_invoke(hObj,"Caption") ; Should not be necessary, may not be
   if !hWnd := WinExist(sCaption) ; Should not Happen !?
      MsgBox No Window Could Be found!`nhWnd: %hWnd%`nsCaption: %sCaption%
   ;return the caption to MS Word
   com_invoke(hObj,"Caption=","")
   return hWnd
   }


; **************************************************************************
; Author:   ahklerner
; Language:   AutoHotkey v1.0.47.06
; Creation Date:   05/19/2008   14:36
; Function Name:   Word_GetActiveHwnd()
;
; Returns the hWnd for the active Word Object's Window
;
; Syntax:
;    Word_GetActiveHwnd()
; Parameters:
;   None
; Return:
;    Success = hWnd
;    Failure = nothing
; **************************************************************************
Word_GetActiveHwnd(){
   hWnd := Word_ObjGetHwnd(hObj := Word_Attach())
   Word_Detach(hObj)
   return hWnd
   }

; **************************************************************************
; Author:   ahklerner
; Language:   AutoHotkey v1.0.47.06
; Creation Date:   05/19/2008   14:45
; Function Name:   Word_Activate()
;
; Activate & Show the Active Word Object
;
; Syntax:
;    Word_Activate()
; Parameters:
;   None
; Return:
;    Success =
;    Failure =
; **************************************************************************
Word_Activate(){
   WinActivate, % "ahk_id " . hWnd := Word_GetActiveHwnd()
   WinShow, % "ahk_id " . hWnd
   }   


_________________


Last edited by ahklerner on Thu Sep 04, 2008 10:28 pm; edited 13 times in total
Back to top
View user's profile Send private message
ahklerner



Joined: 26 Jun 2006
Posts: 1205
Location: USA

PostPosted: Sun May 18, 2008 12:17 am    Post subject: Reply with quote

MS Excel:
A test script:

Code:
COM_Init()
Excel_Open()
Columns = ABCDEFGH
Rows = 8
Loop, Parse, Columns
   {
   a := A_LoopField
   Loop, %Rows%
      Excel_SetText(a, A_Index, a . A_Index)
   }
COM_Term()

a test script for getting value of a cell
Code:

COM_Init() ; Initialize COM
Excel_Open()
MsgBox Type some text in cell A1`nThen press #a
Return

#a::
MsgBox, % Excel_GetCell("A",1) ; <- change this
return

esc::
Excel_Close()
Sleep, 1000 ; sometimes i get rogue excel processes without this....why??
COM_Term()
exitapp

;#Include Excel.com.ahk
;#Include COM.ahk

Code:
example for inserting vbscript and executing it.
VBcode=
(
Sub Anything()
   MsgBox("YEAH")
End Sub
)

COM_Init()
Excel_ImportCode(VBcode) ; you cant call this twice with the same code
Excel_Run("Anything")
COM_Term()
return

Excel_Run(sFunction){
   if oExcel := COM_GetActiveObject("Excel.Application")
      COM_Invoke(oExcel,"Run", sFunction)
   COM_Release(oExcel)
}

Excel_ImportCode(VBcode){
   if fileexist(A_ScriptDir . "\tempvbcode.txt")
      FileDelete, %A_ScriptDir%\tempvbcode.txt
   FileAppend, %VBcode%, %A_ScriptDir%\tempvbcode.txt
   if oExcel := COM_GetActiveObject("Excel.Application")
      if oActiveWorkbook := COM_Invoke(oExcel,"ActiveWorkbook")
         if oVBProject := COM_Invoke(oActiveWorkbook,"VBProject")
            if oVBComponents := COM_Invoke(oVBProject,"VBComponents")
               COM_Invoke(oVBComponents,"Import", A_ScriptDir . "\tempvbcode.txt")
   COM_Release(oVBComponents)
   COM_Release(oVBProject)
   COM_Release(oWorkbooks)
   COM_Release(oExcel)
}

Code:
; **************************************************************************
; Author:   NKRUZAN
; Language:   AutoHotkey v1.0.47.06
; Creation Date:   06/29/2008   21:35
; Function Name:   Excel_GetCell()
;
; get text from the specified cell
;
; Syntax:
;    Excel_GetCell(ColumnLetter, RowNumber)
;
; Example:
;    MsgBox % Excel_GetCell("A", 1)
;
; Parameters:
; 1)    ColumnLetter   =    The column letter
; 2) RowNumber   =    The row Number
; Return:
;    Success = the value of the cell
;    Failure = nothing
; **************************************************************************

Excel_GetCell(ColumnLetter, RowNumber){
   if !oExcel := COM_GetActiveObject("Excel.Application") { ; Get the Already Running Instance
      MsgBox Could not find Excel Instance.
      Return
      }
   if !oCells := COM_Invoke(oExcel,"Cells",RowNumber,Excel_GetColumnIndex(ColumnLetter)) {
      MsgBox Could not get cells.
      Return
      }
   Value := COM_Invoke(oCells,"Value")
   COM_Release(oCells)
   COM_Release(oExcel)
   return Value
}

; **************************************************************************
; Author:   NKRUZAN
; Language:   AutoHotkey v1.0.47.06
; Creation Date:   05/19/2008   16:47
; Function Name:   Excel_SetText()
;
; Syntax:
;    Excel_SetText(ColumnLetter, RowNumber, Text)
; Parameters:
; 1)    ColumnLetter   =    The column letter to put the text in
; 2) RowNumber   =    The row Number to put the text in
; 3) Text       =    The text to put in the cell
; Return:
;    Success = nothing
;    Failure = nothing
; **************************************************************************
Excel_SetText(ColumnLetter, RowNumber, Text){
   if !oExcel := COM_GetActiveObject("Excel.Application") { ; Get the Already Running Instance
      MsgBox Could not find Excel Instance.
      Return
      }
   ;Get the cell range
   if !oCells := COM_Invoke(oExcel,"Cells",RowNumber,Excel_GetColumnIndex(ColumnLetter)) {
      MsgBox Could not get cell range.
      Return
      }
   COM_Invoke(oCells,"Formula=",Text)
   COM_Release(oCells)
   COM_Release(oExcel)
}

; get the index corresponding to the column

; **************************************************************************
; Author:   NKRUZAN
; Language:   AutoHotkey v1.0.47.06
; Creation Date:   05/19/2008   16:55
; Function Name:   Excel_GetColumnIndex()
;
; Syntax:
;    Excel_GetColumnIndex(ColumnLetter)
; Parameters:
; 1)   ColumnLetter   =    
; Return:
;    Success =
;    Failure =
; **************************************************************************
Excel_GetColumnIndex(ColumnLetter){
   local t1 := 0, t2 = 0
   StringUpper, ColumnLetter, ColumnLetter
   Loop, Parse, ColumnLetter
      t%A_Index% := Asc(A_LoopField) - 64
   t2 != 0 ? Col := (26 * t1) + t2 : Col := t1
   Return Col
   }

; **************************************************************************
; Author:   NKRUZAN
; Language:   AutoHotkey v1.0.47.06
; Creation Date:   05/19/2008   16:54
; Function Name:   Excel_Open()
;
; Create a new excel instance
;
; Syntax:
;    Excel_Open()
; Parameters:
;   None
; Return:
;    Success = nothing
;    Failure = nothing
; **************************************************************************

Excel_Open(){
   oExcel := COM_CreateObject("Excel.Application")
   COM_Invoke(oExcel,"Visible=",True)
   COM_Invoke(oExcel,"Activate")
   oWorkbooks := COM_Invoke(oExcel,"Workbooks")
   COM_Invoke(oWorkbooks,"Add")
   COM_Release(oWorkbooks)
   COM_Release(oExcel)
   }
   
Excel_Close(){
   oExcel := COM_GetActiveObject("Excel.Application")
   COM_Invoke(oExcel,"Quit")
   COM_Release(oExcel)
   Sleep, 1000
   }


; **************************************************************************
; Author:   NKRUZAN
; Language:   AutoHotkey v1.0.47.06
; Creation Date:   05/19/2008   16:55
; Function Name:   Excel_OpenDoc()
;
; Open the specified document....
;
; Syntax:
;    Excel_OpenDoc(FileName)
; Parameters:
; 1)   FileName   =    should be a FULL PATH
; Return:
;    Success =
;    Failure =
; **************************************************************************
Excel_OpenDoc(FileName){
   oExcel := COM_CreateObject("Excel.Application")
   COM_Invoke(oExcel,"Visible=",True)
   COM_Invoke(oExcel,"Activate")
   oWorkbooks := COM_Invoke(oExcel,"Workbooks")
   COM_Invoke(oWorkbooks,"Open",FileName) ; open the file
   COM_Release(oWorkbooks)
   COM_Release(oExcel)
   }


; **************************************************************************
; Author:   NKRUZAN
; Language:   AutoHotkey v1.0.47.06
; Creation Date:   05/19/2008   16:55
; Function Name:   Excel_GetActiveTitle()
;
;Get the title of the Active workbook open in Excel
;
; Syntax:
;    Excel_GetActiveTitle()
; Parameters:
;   None
; Return:
;    Success =
;    Failure =
; **************************************************************************
Excel_GetActiveTitle(){
   oExcel := COM_CreateObject("Excel.Application")
   COM_Invoke(oExcel,"Visible=",True)
   COM_Invoke(oExcel,"Activate")
   oActiveWorkbook := COM_Invoke(oExcel,"ActiveWorkbook")
   Name := COM_Invoke(oActiveWorkbook,"Name") ; Get the name
   COM_Release(oActiveWorkbook)
   COM_Release(oExcel)
   return Name
   }


_________________


Last edited by ahklerner on Thu Sep 04, 2008 10:28 pm; edited 9 times in total
Back to top
View user's profile Send private message
ahklerner



Joined: 26 Jun 2006
Posts: 1205
Location: USA

PostPosted: Sun May 18, 2008 12:17 am    Post subject: Reply with quote

MS Powerpoint:
_________________
Back to top
View user's profile Send private message
ahklerner



Joined: 26 Jun 2006
Posts: 1205
Location: USA

PostPosted: Sun May 18, 2008 12:18 am    Post subject: Reply with quote

MS Access:
_________________
Back to top
View user's profile Send private message
ahklerner



Joined: 26 Jun 2006
Posts: 1205
Location: USA

PostPosted: Sun May 18, 2008 12:18 am    Post subject: Reply with quote

MS Outlook:
Please read this page if you get an access error.
http://office.microsoft.com/en-us/outlook/HA011127891033.aspx

Test script: (you need to have outlook open and double click on an email so that it is in it's own window, then run the script)
Code:
;OUTLOOK TEST SCRIPT
com_CoInitialize()
MsgBox % Outlook_GetMessageText()
com_CoUnInitialize()
exitapp


Code:
;Get Currently Opened Email Text
Outlook_GetMessageText(){
   if !Outlook := COM_GetActiveObject("Outlook.Application") {
      MsgBox Could not start Outlook Instance.
      Return
      }
   if !ActiveInspector := com_invoke(Outlook,"ActiveInspector"){
      MsgBox Could not get Inspector.
      Return
      }
   if !CurrentItem := com_invoke(ActiveInspector,"CurrentItem"){
      MsgBox Could not load current Document.
      Return
      }
   if !Body := com_invoke(CurrentItem,"Body"){
      MsgBox Could not get document text.
      Return
      }
   com_release(CurrentItem)
   com_release(ActiveInspector)
   com_release(Outlook)
   return Body
   }

_________________


Last edited by ahklerner on Thu Sep 04, 2008 10:29 pm; edited 6 times in total
Back to top
View user's profile Send private message
wygd



Joined: 04 Nov 2007
Posts: 5

PostPosted: Sun May 18, 2008 2:05 am    Post subject: Reply with quote

thanks fo your work.

I need some examples.
Back to top
View user's profile Send private message
Guest






PostPosted: Sun May 18, 2008 4:43 am    Post subject: Reply with quote

Thanks ahklerner.
Back to top
Laszlo



Joined: 14 Feb 2005
Posts: 4016
Location: Pittsburgh

PostPosted: Sun May 18, 2008 4:47 am    Post subject: Reply with quote

Excellent! I have always struggled in MS Word to get (and change) the selected text, without the clipboard (which has to be saved and restored each time). It looks like we have a good solution now. Thank you for sharing your work!
Back to top
View user's profile Send private message
ahklerner



Joined: 26 Jun 2006
Posts: 1205
Location: USA

PostPosted: Sun May 18, 2008 5:08 am    Post subject: Reply with quote

wygd wrote:
I need some examples.

What Kind of examples are you looking for? Please provide some example examples. Very Happy

Laszlo wrote:
Thank you for sharing your work!
Glad it was useful to you. Smile
_________________
Back to top
View user's profile Send private message
heresy



Joined: 11 Mar 2008
Posts: 291

PostPosted: Sun May 18, 2008 6:55 am    Post subject: Reply with quote

hey ahklerner
i haven't check it yet but seems you made necessary one
when i get on desk, i'll test your functions with Word/Excel 2007 versions
it would be my favorite one thanks for sharing!

EDIT : very cool.
confirmed on 2007 version too.
i'll keep looking and cheer for this
you've done a great job ahklerner
we don't need VBA now Laughing
_________________
Easy WinAPI - Dive into Windows API World
Benchmark your AutoHotkey skills at PlayAHK.com
Back to top
View user's profile Send private message
ahklerner



Joined: 26 Jun 2006
Posts: 1205
Location: USA

PostPosted: Sun May 18, 2008 4:28 pm    Post subject: Reply with quote

Added Outlook_GetMessageText().
_________________
Back to top
View user's profile Send private message
n-l-i-d
Guest





PostPosted: Sun May 18, 2008 6:22 pm    Post subject: Reply with quote

This might help too: [url=http://msdn.microsoft.com/en-us/library/bb190882(office.11).aspx]Office 2003 VBA language reference @ MSDN[/url] (older Office versions might user other calls)
Back to top
ahklerner



Joined: 26 Jun 2006
Posts: 1205
Location: USA

PostPosted: Mon May 19, 2008 8:52 pm    Post subject: Reply with quote

added
Code:
; Word_SetCurrentFont(Font,FontSize,Bold,Italic,Caps)

and updated test script. other various changes.
_________________
Back to top
View user's profile Send private message
ahklerner



Joined: 26 Jun 2006
Posts: 1205
Location: USA

PostPosted: Mon May 19, 2008 11:34 pm    Post subject: Reply with quote

added a poll
_________________
Back to top
View user's profile Send private message
k3ph



Joined: 21 Jul 2006
Posts: 123

PostPosted: Tue May 20, 2008 1:13 am    Post subject: Reply with quote

Excel one is interesting, thanks for it Wink keep working!

and yeah, dont forget MS Office System is kinda big:
Excel, Groove, InfoPath, OneNote, Outlook, PowerPoint, Project, Publisher, SharePoint Designer, Visio, Word...
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page 1, 2, 3, 4  Next
Page 1 of 4

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group