| View previous topic :: View next topic |
| Author |
Message |
as1234 General User

Joined: 30 Apr 2012 Posts: 12
|
Posted: Wed May 16, 2012 12:33 pm Post subject: Changing user's properties in the documents with a macro |
|
|
Pls Help ! Need a macro . How to connect the two documents(writer). Edit the user's properties of the first document. So the user's properties in the second document have changed too
sorry for my english  |
|
| Back to top |
|
 |
pitonyak Administrator


Joined: 09 Mar 2004 Posts: 3618 Location: Columbus, Ohio, USA
|
Posted: Thu May 17, 2012 8:33 pm Post subject: |
|
|
Do you mean this information:
| Code: | Sub GetDocumentProperties
Dim oProps
Dim oDocProps
Dim s$
Dim i As Integer
Dim prop
oDocProps = ThisComponent.getDocumentProperties()
s = s & "Author = " & oDocProps.Author & CHR$(10) & _
"AutoLoadSecs = " & oDocProps.AutoloadSecs & CHR$(10) & _
"AutoLoadURL = " & oDocProps.AutoloadURL & CHR$(10) & _
"CreationDate = " & DateSTructToString(oDocProps.CreationDate) & _
CHR$(10) & _
"Default Target = " & oDocProps.DefaultTarget & CHR$(10) & _
"Description = " & oDocProps.Description & CHR$(10) & _
"EditingCycles = " & oDocProps.EditingCycles & CHR$(10) & _
"EditingDuration = " & oDocProps.EditingDuration & CHR$(10) & _
"Generator = " & oDocProps.Generator & CHR$(10) & _
"Language = (" & oDocProps.Language.Country & ", " & _
oDocProps.Language.Language & ", " & _
oDocProps.Language.Variant & ")" & CHR$(10) & _
"ModificationDate = " & _
DateSTructToString(oDocProps.ModificationDate) & CHR$(10) & _
"ModifiedBy = " & oDocProps.ModifiedBy & CHR$(10) & _
"PrintDate = " & DateSTructToString(oDocProps.PrintDate) & _
CHR$(10) & _
"PrintedBy = " & oDocProps.PrintedBy & CHR$(10) & _
"Subject = " & oDocProps.Subject & CHR$(10) & _
"TemplateDate = " & _
DateSTructToString(oDocProps.TemplateDate) & CHR$(10) & _
"TemplateName" & oDocProps.TemplateName & CHR$(10) & _
"TemplateURL" & oDocProps.TemplateURL & CHR$(10) & _
"Title = " & oDocProps.Title & CHR$(10) & _
""
oProps = oDocProps.UserDefinedProperties
s = s & "Info 1 = " & oProps.[Info 1] & CHR$(10) & _
"Info 2 = " & oProps.[Info 2] & CHR$(10) & _
"Info 3 = " & oProps.[Info 3] & CHR$(10) & _
"Info 4 = " & oProps.[Info 4]
MsgBox s
If LBound(oDocProps.Keywords) <= UBound(oDocProps.Keywords) Then
MsgBox Join(oDocProps.Keywords, CHR$(10)),,"Keywords"
End If
s = ""
Dim oStats : oStats = oDocProps.DocumentStatistics
For i = LBound(oStats) To UBound(oStats)
s = s & oStats(i).Name & " = " & oStats(i).Value & CHR$(10)
Next
MsgBox s
End Sub
Function DateSTructToString(ostruct) As String
DateSTructToString() = ostruct.Month & "/" & _
ostruct.Day & "/" & ostruct.Year & " at " & _
ostruct.Hours & ":" & ostruct.Minutes & ":" & _
ostruct.Seconds & "." & ostruct.HundredthSeconds
End Function |
_________________ --
Andrew Pitonyak
http://www.pitonyak.org/oo.php |
|
| Back to top |
|
 |
as1234 General User

Joined: 30 Apr 2012 Posts: 12
|
Posted: Sat May 19, 2012 10:13 am Post subject: |
|
|
mmm...no .
I mean . Use a macro , and after Info1 in document one = info1 in document two . ))
It's possible? |
|
| Back to top |
|
 |
pitonyak Administrator


Joined: 09 Mar 2004 Posts: 3618 Location: Columbus, Ohio, USA
|
Posted: Sat May 19, 2012 11:08 am Post subject: |
|
|
Do you know how to program?
You need to get the document properties as shown in the macro above from both document and then assign values from one to the other. _________________ --
Andrew Pitonyak
http://www.pitonyak.org/oo.php |
|
| Back to top |
|
 |
as1234 General User

Joined: 30 Apr 2012 Posts: 12
|
Posted: Sun May 20, 2012 8:49 am Post subject: |
|
|
Not good , I started to learn programming a month ago  |
|
| Back to top |
|
 |
pitonyak Administrator


Joined: 09 Mar 2004 Posts: 3618 Location: Columbus, Ohio, USA
|
Posted: Sun May 20, 2012 7:10 pm Post subject: |
|
|
OK, so what is obvious to a "programmer" is not so obvious to a non-programmer....
I assumed you had two documents (referenced by variables or similar) and you just needed to know how to copy from one to the other. Now, I assume that you require an entire system that is able to say something like .... Choose source document, choose target document, now copy from source to target. _________________ --
Andrew Pitonyak
http://www.pitonyak.org/oo.php |
|
| Back to top |
|
 |
as1234 General User

Joined: 30 Apr 2012 Posts: 12
|
Posted: Sun May 20, 2012 10:50 pm Post subject: |
|
|
| Quote: | | I assumed you had two documents (referenced by variables or similar) and you just needed to know how to copy from one to the other. Now, I assume that you require an entire system that is able to say something like .... Choose source document, choose target document, now copy from source to target. |
Yep , this very similar to what I need |
|
| Back to top |
|
 |
|