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 Previous  1, 2, 3 ... 11, 12, 13 ... 18, 19, 20  Next
 
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
tank



Joined: 21 Dec 2007
Posts: 3700
Location: Louisville KY USA

PostPosted: Thu Jan 07, 2010 4:24 am    Post subject: Reply with quote

you are correct it doesnt work correctly in that it generates an error i and sinkfaze both use com_error(0) prior to calling it which works fine doesnt to me seem important enuff to worry about it as its the only instance i have ever seen of such a problem
_________________

We are troubled on every side‚ yet not distressed; we are perplexed‚
but not in despair; Persecuted‚ but not forsaken; cast down‚ but not destroyed;
Back to top
View user's profile Send private message
neXt



Joined: 18 Mar 2007
Posts: 505

PostPosted: Thu Jan 07, 2010 4:56 am    Post subject: Reply with quote

Ah, so com_error(0) works like "On Error Resume Next" in VB?
_________________
simplified csv - easy way to handle csv files.
Back to top
View user's profile Send private message
tank



Joined: 21 Dec 2007
Posts: 3700
Location: Louisville KY USA

PostPosted: Thu Jan 07, 2010 2:11 pm    Post subject: Reply with quote

no but yea
_________________

We are troubled on every side‚ yet not distressed; we are perplexed‚
but not in despair; Persecuted‚ but not forsaken; cast down‚ but not destroyed;
Back to top
View user's profile Send private message
neXt



Joined: 18 Mar 2007
Posts: 505

PostPosted: Sat Jan 09, 2010 12:40 am    Post subject: Reply with quote

Holy crap, i just realized i can run VBA code through this library!!!
Code:
COM_Init()

objExcel := COM_GetActiveObject("Excel.Application")
COM_Invoke(objExcel, "Run", "Book1!test")


I can finally have my VBA apps run through exe !!!!!!!!!!!!!!! This is so awesome!
_________________
simplified csv - easy way to handle csv files.
Back to top
View user's profile Send private message
Angelir
Guest





PostPosted: Wed Jan 20, 2010 4:47 pm    Post subject: Copy WorkSheet, and Activate Cells, and Inster/Delete Rows Reply with quote

I search it some hour but not find any of them:
1. Are there any method to Copy a full Worksheet then paste is as a new Worksheet? (In the same Workbook)
2. Are there any method, to activate a Cell?
3. Are there any method, to instert or delete rows (and the instert is like the original insert funkcion, so get up the style of the upper row.)

The first, and the third is really need me, (the second only for the third to know where create the new row.)

Please if somebody know the answer, then wrote it down. If there arent any of them, then tell me it is able to create or not.

I'm really obliged if i get these snippets. So if somebody can, please help. Its important for me.
Back to top
The Unknown Jobber



Joined: 19 Nov 2009
Posts: 161
Location: Florida

PostPosted: Fri Jan 22, 2010 2:05 pm    Post subject: Reply with quote

removed

Last edited by The Unknown Jobber on Mon Jan 25, 2010 5:33 pm; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
sinkfaze



Joined: 18 Mar 2008
Posts: 5044
Location: the tunnel(?=light)

PostPosted: Fri Jan 22, 2010 2:42 pm    Post subject: Reply with quote

GetOutlook() does not access the Application object so I think we're missing something. What is the entire code you're working with?
_________________
Try Quick Search for Autohotkey or see the tutorial for newbies.
Back to top
View user's profile Send private message Send e-mail
The Unknown Jobber



Joined: 19 Nov 2009
Posts: 161
Location: Florida

PostPosted: Fri Jan 22, 2010 3:14 pm    Post subject: Reply with quote

removed

Last edited by The Unknown Jobber on Mon Jan 25, 2010 5:33 pm; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
Sean



Joined: 12 Feb 2007
Posts: 2462

PostPosted: Fri Jan 22, 2010 4:22 pm    Post subject: Reply with quote

What's the point of your post? I've never mentioned Outlook in the post of GetNativeOM, it was only your imagination that it would work for Outlook even regardless of the control chosen, which you arbitrarily picked up RichEdit20W for, and you just proved that it was an illusion. GetNativeOM will only work for Excel, PowerPoint, and Word, at least up to Office 2003.
Back to top
View user's profile Send private message
The Unknown Jobber



Joined: 19 Nov 2009
Posts: 161
Location: Florida

PostPosted: Fri Jan 22, 2010 5:19 pm    Post subject: Reply with quote

removed

Last edited by The Unknown Jobber on Thu Sep 02, 2010 3:10 pm; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
Sean



Joined: 12 Feb 2007
Posts: 2462

PostPosted: Sat Jan 23, 2010 12:49 am    Post subject: Reply with quote

If you just wanted to know about Outlook and GetNativeOM, you could simply have asked about it first. You should not provide a incorrect info: working in Office 2003 but not working in Office 2007 which was wrong. It'll mis-guide other members to possibly waste their precious time, well it already seemed so for sinkfaze.
Back to top
View user's profile Send private message
The Unknown Jobber



Joined: 19 Nov 2009
Posts: 161
Location: Florida

PostPosted: Mon Jan 25, 2010 1:23 pm    Post subject: Reply with quote

removed

Last edited by The Unknown Jobber on Thu Sep 02, 2010 3:10 pm; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
sinkfaze



Joined: 18 Mar 2008
Posts: 5044
Location: the tunnel(?=light)

PostPosted: Mon Jan 25, 2010 4:01 pm    Post subject: Reply with quote

frescalus, you're not trying to understand Sean's point at all. These functions are somewhat high end for what people can do with AHK, which means it requires a greater understanding of the inner workings of Office applications and the Visual Basic scripting language. Your assumption in creating GetOutlook(), while imaginative, demonstrated that you don't understand why the proper functions work (or why that method only works for certain Office apps). Bad code in the forums is more critical here than in other instances, and since you misused Sean's code (which implicates him as the author), he was understandably upset. If you want to experiment but lack the fundamental understanding, just ask but never assume. Nobody is unwilling to help, but you should expect that you need to know/be willing to learn about the inner workings of Office apps and VBScript.
_________________
Try Quick Search for Autohotkey or see the tutorial for newbies.
Back to top
View user's profile Send private message Send e-mail
The Unknown Jobber



Joined: 19 Nov 2009
Posts: 161
Location: Florida

PostPosted: Mon Jan 25, 2010 5:35 pm    Post subject: Reply with quote

Removed content from both of my posts
Back to top
View user's profile Send private message Visit poster's website
Gabor



Joined: 09 Feb 2010
Posts: 3

PostPosted: Wed Feb 10, 2010 5:46 am    Post subject: Reply with quote

Hi, can somebody help me?
It an method does not work and I cannot solve it unfortunately:

http://msdn.microsoft.com/en-us/library/aa171543%28office.11%29.aspx

Word_TextBox(Text){
Word := Word_Attach("A")
ActiveDocument := com_invoke(Word,"ActiveDocument")
Shape := com_invoke(ActiveDocument,"Shapes")
AddTextBox := com_invoke(Shape,"AddTextBox",Orientation:=msoTextOrientationHorizontal, Left:=100, Top:=100, Width:=300, Height:=200)

TextFrame := com_invoke(AddTextBox,"TextFrames")
TextRange := com_invoke(TextFrame,"TextRange")
Text := com_invoke(TextRange,"Text=",Text)

COM_Release(ActiveDocument)
COM_Release(Word)
COM_Release(Shapes)
COM_Release(AddTextBox)
}

Any help would be really appreciated thanks!


Last edited by Gabor on Wed Feb 10, 2010 4:49 pm; edited 1 time in total
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page Previous  1, 2, 3 ... 11, 12, 13 ... 18, 19, 20  Next
Page 12 of 20

 
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