If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
Outlook-Word automation problem
Hallo,
I run an internet reviewing and editing office providing language services for scientists. I receive nearly all work as attachments in MS Word format. I want to automate the logging in of work by 1. sending a copy of the file to two new folders (named Originals and Edits) inside a folder named after the author name and arrival date. Example: top level folder \filbyNov06 contains two subfolders \Edits and \Originals. Originals contains the unaltered attachments; \Edits contains a renamed version of the same with suffix EDIT, saved with Track Chgs switched on. Thd code also prints out a worksheet based on a Word template. No problems so far. The problems begin when I try to prepare an invoice based on the data I can extract from the attachment with code like this: Set myOlApp = CreateObject("Outlook.Application") Dim SaveDirecty As String ' correct path is C:\Dokumente und Einstellungen\Gordon Filby\Eigene Dateien\Eigene Dokumente\AAAInnovEditStuff\AAPaidWork\2006 Set myItem = Application.ActiveExplorer.Selection(1) Set myOlApp = CreateObject("Outlook.Application") Set myAttachments = myItem.Attachments .. .. .. .. Dim GFPaperTitle As String Dim TitleRge As Range Set TitleRge = ActiveDocument.Paragraphs(1).Range 'assumes first Paragraph contains the title GFPaperTitle = TitleRge.Text I'd planned to drop this into two fields (Guessed Title and True Title) on a userform during initialisation, then correct the true title "by hand" the same way as I do with the other data I can't extract from the original document. Once complete all this data would be inserted into the invoice (template in MS Word) and printed as the final invoice. The trouble is I can't see how to to do the initialisation via a variable (GFPaperTitle). All the other fields on the form work fine, they are done with code like: Public Sub UserForm_Initialize() 'Puts them in the fields of MakeRechnung form. ComboBox1.List = Array("Athens", "Bari", "Brno", "Bucharest", "Gliwice", "Kozani", _ "Lisbon", "Lublin", "Milan", "Mostar", "Nancy", "Olsztyn", "Riga", "Seoul", "Tartu", "Warsaw") ComboBox1.Value = "Lublin" ComboBox2.List = Array("Dr.", "Prof. Dr.", "Prof.", "Dr. med") ComboBox2.Value = "Dr." ComboBox3.List = Array("Bosnia-Hzgvna", "Brazil", "China", "Czech Republic", "Finland", "France", "Germany", "Greece", "Iran", "Italy", "Latvia", "Peru", "Poland", "Portugal", "Romania", "South Korea", "Spain", "Turkey", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20") ComboBox3.Value = "Poland" TextBox6.Value = "EUR" TextBox15.Value = "06-nnn-Aut-Cy-Subj" TextBox12.Value = "XYZ" 'GFPaperTitle TextBox14.Value = GFPaperTitle End Sub In other words the lines: TextBox12.Value = "XYZ" THIS WORKS 'GFPaperTitle THIS DOESN'T TextBox14.Value = GFPaperTitle THIS DOESN'T EITHER are the problematic ones. I'd be very grateful for any insights. Regards, Gordon Filby |
Ads |
#2
|
|||
|
|||
Outlook-Word automation problem
Is GFPaperTitle declared as a Public in the declarations section of a regular code module?
-- Sue Mosher, Outlook MVP Author of Configuring Microsoft Outlook 2003 http://www.turtleflock.com/olconfig/index.htm and Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "Gordon Filby" wrote in message ... Hallo, I run an internet reviewing and editing office providing language services for scientists. I receive nearly all work as attachments in MS Word format. I want to automate the logging in of work by 1. sending a copy of the file to two new folders (named Originals and Edits) inside a folder named after the author name and arrival date. Example: top level folder \filbyNov06 contains two subfolders \Edits and \Originals. Originals contains the unaltered attachments; \Edits contains a renamed version of the same with suffix EDIT, saved with Track Chgs switched on. Thd code also prints out a worksheet based on a Word template. No problems so far. The problems begin when I try to prepare an invoice based on the data I can extract from the attachment with code like this: Set myOlApp = CreateObject("Outlook.Application") Dim SaveDirecty As String ' correct path is C:\Dokumente und Einstellungen\Gordon Filby\Eigene Dateien\Eigene Dokumente\AAAInnovEditStuff\AAPaidWork\2006 Set myItem = Application.ActiveExplorer.Selection(1) Set myOlApp = CreateObject("Outlook.Application") Set myAttachments = myItem.Attachments . . . . Dim GFPaperTitle As String Dim TitleRge As Range Set TitleRge = ActiveDocument.Paragraphs(1).Range 'assumes first Paragraph contains the title GFPaperTitle = TitleRge.Text I'd planned to drop this into two fields (Guessed Title and True Title) on a userform during initialisation, then correct the true title "by hand" the same way as I do with the other data I can't extract from the original document. Once complete all this data would be inserted into the invoice (template in MS Word) and printed as the final invoice. The trouble is I can't see how to to do the initialisation via a variable (GFPaperTitle). All the other fields on the form work fine, they are done with code like: Public Sub UserForm_Initialize() 'Puts them in the fields of MakeRechnung form. ComboBox1.List = Array("Athens", "Bari", "Brno", "Bucharest", "Gliwice", "Kozani", _ "Lisbon", "Lublin", "Milan", "Mostar", "Nancy", "Olsztyn", "Riga", "Seoul", "Tartu", "Warsaw") ComboBox1.Value = "Lublin" ComboBox2.List = Array("Dr.", "Prof. Dr.", "Prof.", "Dr. med") ComboBox2.Value = "Dr." ComboBox3.List = Array("Bosnia-Hzgvna", "Brazil", "China", "Czech Republic", "Finland", "France", "Germany", "Greece", "Iran", "Italy", "Latvia", "Peru", "Poland", "Portugal", "Romania", "South Korea", "Spain", "Turkey", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20") ComboBox3.Value = "Poland" TextBox6.Value = "EUR" TextBox15.Value = "06-nnn-Aut-Cy-Subj" TextBox12.Value = "XYZ" 'GFPaperTitle TextBox14.Value = GFPaperTitle End Sub In other words the lines: TextBox12.Value = "XYZ" THIS WORKS 'GFPaperTitle THIS DOESN'T TextBox14.Value = GFPaperTitle THIS DOESN'T EITHER are the problematic ones. I'd be very grateful for any insights. Regards, Gordon Filby |
#3
|
|||
|
|||
Outlook-Word automation problem
Hallo,
It wasn't, but it is now. Unfortunately it made no difference. In the line: TextBox14.Value = GFPaperTitle below, GFPaperTitle is "empty" (is this a clue? not "") on stepping through the whole procedure. GF "Sue Mosher [MVP-Outlook]" schrieb im Newsbeitrag ... Is GFPaperTitle declared as a Public in the declarations section of a regular code module? -- Sue Mosher, Outlook MVP Author of Configuring Microsoft Outlook 2003 http://www.turtleflock.com/olconfig/index.htm and Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "Gordon Filby" wrote in message ... Hallo, I run an internet reviewing and editing office providing language services for scientists. I receive nearly all work as attachments in MS Word format. I want to automate the logging in of work by 1. sending a copy of the file to two new folders (named Originals and Edits) inside a folder named after the author name and arrival date. Example: top level folder \filbyNov06 contains two subfolders \Edits and \Originals. Originals contains the unaltered attachments; \Edits contains a renamed version of the same with suffix EDIT, saved with Track Chgs switched on. Thd code also prints out a worksheet based on a Word template. No problems so far. The problems begin when I try to prepare an invoice based on the data I can extract from the attachment with code like this: Set myOlApp = CreateObject("Outlook.Application") Dim SaveDirecty As String ' correct path is C:\Dokumente und Einstellungen\Gordon Filby\Eigene Dateien\Eigene Dokumente\AAAInnovEditStuff\AAPaidWork\2006 Set myItem = Application.ActiveExplorer.Selection(1) Set myOlApp = CreateObject("Outlook.Application") Set myAttachments = myItem.Attachments . . . . Dim GFPaperTitle As String Dim TitleRge As Range Set TitleRge = ActiveDocument.Paragraphs(1).Range 'assumes first Paragraph contains the title GFPaperTitle = TitleRge.Text I'd planned to drop this into two fields (Guessed Title and True Title) on a userform during initialisation, then correct the true title "by hand" the same way as I do with the other data I can't extract from the original document. Once complete all this data would be inserted into the invoice (template in MS Word) and printed as the final invoice. The trouble is I can't see how to to do the initialisation via a variable (GFPaperTitle). All the other fields on the form work fine, they are done with code like: Public Sub UserForm_Initialize() 'Puts them in the fields of MakeRechnung form. ComboBox1.List = Array("Athens", "Bari", "Brno", "Bucharest", "Gliwice", "Kozani", _ "Lisbon", "Lublin", "Milan", "Mostar", "Nancy", "Olsztyn", "Riga", "Seoul", "Tartu", "Warsaw") ComboBox1.Value = "Lublin" ComboBox2.List = Array("Dr.", "Prof. Dr.", "Prof.", "Dr. med") ComboBox2.Value = "Dr." ComboBox3.List = Array("Bosnia-Hzgvna", "Brazil", "China", "Czech Republic", "Finland", "France", "Germany", "Greece", "Iran", "Italy", "Latvia", "Peru", "Poland", "Portugal", "Romania", "South Korea", "Spain", "Turkey", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20") ComboBox3.Value = "Poland" TextBox6.Value = "EUR" TextBox15.Value = "06-nnn-Aut-Cy-Subj" TextBox12.Value = "XYZ" 'GFPaperTitle TextBox14.Value = GFPaperTitle End Sub In other words the lines: TextBox12.Value = "XYZ" THIS WORKS 'GFPaperTitle THIS DOESN'T TextBox14.Value = GFPaperTitle THIS DOESN'T EITHER are the problematic ones. I'd be very grateful for any insights. Regards, Gordon Filby |
#4
|
|||
|
|||
Outlook-Word automation problem
Yes, that's certainly a large part of the problem. Maybe your assumption about TitleRge is incorrect.
-- Sue Mosher, Outlook MVP Author of Configuring Microsoft Outlook 2003 http://www.turtleflock.com/olconfig/index.htm and Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "Gordon Filby" wrote in message ... Hallo, It wasn't, but it is now. Unfortunately it made no difference. In the line: TextBox14.Value = GFPaperTitle below, GFPaperTitle is "empty" (is this a clue? not "") on stepping through the whole procedure. GF "Sue Mosher [MVP-Outlook]" schrieb im Newsbeitrag ... Is GFPaperTitle declared as a Public in the declarations section of a regular code module? "Gordon Filby" wrote in message ... Hallo, I run an internet reviewing and editing office providing language services for scientists. I receive nearly all work as attachments in MS Word format. I want to automate the logging in of work by 1. sending a copy of the file to two new folders (named Originals and Edits) inside a folder named after the author name and arrival date. Example: top level folder \filbyNov06 contains two subfolders \Edits and \Originals. Originals contains the unaltered attachments; \Edits contains a renamed version of the same with suffix EDIT, saved with Track Chgs switched on. Thd code also prints out a worksheet based on a Word template. No problems so far. The problems begin when I try to prepare an invoice based on the data I can extract from the attachment with code like this: Set myOlApp = CreateObject("Outlook.Application") Dim SaveDirecty As String ' correct path is C:\Dokumente und Einstellungen\Gordon Filby\Eigene Dateien\Eigene Dokumente\AAAInnovEditStuff\AAPaidWork\2006 Set myItem = Application.ActiveExplorer.Selection(1) Set myOlApp = CreateObject("Outlook.Application") Set myAttachments = myItem.Attachments . . . . Dim GFPaperTitle As String Dim TitleRge As Range Set TitleRge = ActiveDocument.Paragraphs(1).Range 'assumes first Paragraph contains the title GFPaperTitle = TitleRge.Text I'd planned to drop this into two fields (Guessed Title and True Title) on a userform during initialisation, then correct the true title "by hand" the same way as I do with the other data I can't extract from the original document. Once complete all this data would be inserted into the invoice (template in MS Word) and printed as the final invoice. The trouble is I can't see how to to do the initialisation via a variable (GFPaperTitle). All the other fields on the form work fine, they are done with code like: Public Sub UserForm_Initialize() 'Puts them in the fields of MakeRechnung form. ComboBox1.List = Array("Athens", "Bari", "Brno", "Bucharest", "Gliwice", "Kozani", _ "Lisbon", "Lublin", "Milan", "Mostar", "Nancy", "Olsztyn", "Riga", "Seoul", "Tartu", "Warsaw") ComboBox1.Value = "Lublin" ComboBox2.List = Array("Dr.", "Prof. Dr.", "Prof.", "Dr. med") ComboBox2.Value = "Dr." ComboBox3.List = Array("Bosnia-Hzgvna", "Brazil", "China", "Czech Republic", "Finland", "France", "Germany", "Greece", "Iran", "Italy", "Latvia", "Peru", "Poland", "Portugal", "Romania", "South Korea", "Spain", "Turkey", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20") ComboBox3.Value = "Poland" TextBox6.Value = "EUR" TextBox15.Value = "06-nnn-Aut-Cy-Subj" TextBox12.Value = "XYZ" 'GFPaperTitle TextBox14.Value = GFPaperTitle End Sub In other words the lines: TextBox12.Value = "XYZ" THIS WORKS 'GFPaperTitle THIS DOESN'T TextBox14.Value = GFPaperTitle THIS DOESN'T EITHER are the problematic ones. I'd be very grateful for any insights. Regards, Gordon Filby |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Problem With Word Finding Outlook Contact Lists For Email Merge | [email protected] | Outlook - General Queries | 11 | September 20th 06 11:19 PM |
oulook word problem | mcp.tr | Add-ins for Outlook | 0 | July 27th 06 04:07 PM |
Problem with Inspector CommandBars and MS Word | Yuri Loban | Add-ins for Outlook | 4 | July 12th 06 06:26 AM |
Problem Printing Customized Outlook Form using Word Template | ajkim001 | Outlook - Using Forms | 15 | April 28th 06 05:28 PM |
Outlook add-in, MS Word problem | Dennis Masko | Add-ins for Outlook | 1 | February 21st 06 05:42 PM |