Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 111
Default Coding Assistance

As far as the PostItem part is concerned, I'm not quite sure as you may have
to look into Outlook's Events. One thing that I did find in Outlook VBA
that may be of help is the "CreateItemFromTemplate" Method.

Now when working within Excel, maybe you could consider using the BeforeSave
Event on the workbook to create it's name. You can use the following syntax
to refer to a cell for it's text. Don't get it's text and value mixed up as
the value is the cells underlying content while the text is just how it
displays in the cell, thus the text property is read-only.

Workbooks(<Workbookname).Worksheets(<WorksheetNam e).Range(<CellAddress).T
ext

Example:

Workbooks("Book1.xls").Worksheets("Sheet1").Range( "A1").Text

Now, if you are trying to refer to Excel objects within Outlook's VBA, you
will need to create an application object variable and declare it as an
Excel.Application, then use either the CreateObject (if file is not open
yet) or GetObject (if file is already open) method to set the variable to
the workbook. Once this object is set to the variable, you will then be
required to use the application variable to refer to the Excel Objects.
When code no longer needs to use the application variable, be sure to have
it set to "Nothing" (See example below). One other thing though with this
in mind, you must go into ToolsReferences, and make sure there is a check
mark next to the Excel Object Library rather it be version 8.0, 9.0, 10.0,
or 11.0 (2003 beta version)

Example:

Dim xlApp as Excel.Application, wb as Excel.Workbook, check as Boolean
On Error Resume Next
Set xlApp = GetObject(,Excel.Application)
If Err.Number < 0 then
Err.Clear
Set xlApp = CreateObject(Excel.Application)
End If
check = false
For each wb in xlApp.Workbooks
if wb.name =
<NameOfExcelFileYouWantOpenIncludingExtensionButNo tPathName
check = True
Exit For
End If
Next
If Not check Then
xlApp.Workbooks.Open <list of arguments to fill
End If
..
..
..
Set xlApp = Nothing

Hope this helps you get pointed in the right direction.

--
Ronald R. Dodge, Jr.
Production Statistician
Master MOUS 2000
"Shauna Koppang" wrote in message
...
I am a rank VB Beginner and need some help. I posted this
to the Outlook Programming site with no response and I am
urgently trying to finish a project. I would truly
appreciate the help! As this newsgroups users seem much
more responsive I thought someone here might have a
suggestion.

I have created and excel template and attached it to an
Outlook Ppublic folder to create its new items from it.
This is a purchase order system and I am trying to
generate a sequentially unique name for the workbook and
posted item.

When the form is completed by the user, and posted it gets
saved with a default name of Untitled1.xls and what I am
trying to do is code it so that when a user clicks Post
that it names it a custom name, before it posts, which I
know I will have to code in VBA. I belive the
PostItem.Post coding would be needed to somehow help with
this process. I can't seem to find any PostItem examples
anywhere to get coding ideas.

What I want to do is when I invoke the Post button, that
it reads contents from specified cells in the Excel Form
and builds a name based on it.

Any help, or directions to find coding samples or
assistance would be greatly appreciatd.

Thanks so much!

Shauna



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VB Coding johnsail Excel Discussion (Misc queries) 1 February 18th 10 12:54 PM
Need help with coding anna New Users to Excel 4 April 24th 08 05:06 AM
sum by coding without 0 kaja New Users to Excel 1 March 2nd 08 09:09 PM
sum by coding [email protected] New Users to Excel 1 February 27th 08 01:12 PM
coding maisy1 Excel Discussion (Misc queries) 1 August 6th 06 08:58 PM


All times are GMT +1. The time now is 04:22 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"