G
Gordon Filby
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
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