Gast
2010-12-22, 10:05:26
Hallo miteinander,
Ich würde gerne eine GUI zu meinem Code schreiben, habe jedoch noch nie mehr gemacht als Macros zu schreiben.
Wie implementiere ich jetzt eine GUI wo ich die Zeile und die Version eingeben kann (jeweils eigenes Eingabefeld) und sobald ich "GO" Drücke das ganze korrekt übernommen in eine Excel Tabelle schreibe.
der Code ist foglendermassen:
---- following: code ----
Sub insertWordCommentsInExcel()
'
' insertWordCommentsInExcel
' Macro created 09.09.2010 by --
' Last update: 22.12.2010 by --
'
' Current functionality: Take comments, author, page number and predefined version-string
' and write it into currently open Excel-file, beginning with prespecified line number
'
Dim wrdDoc As Word.Document
Dim i, beginCellNbr As Integer
Dim curCmt As Word.Comment
Dim excelApp As Excel.Application
Set excelApp = GetObject(, "Excel.Application")
excelApp.Visible = False
'excelApp.Workbooks.Add
'the following variables need to be defined by the user
beginCellNbr = 7
curDocVersionString = "V1.0"
Set wrdDoc = Word.ActiveDocument
'Word.Documents.Open ("P:\blubb.doc")
For i = beginCellNbr To (wrdDoc.Comments.Count + beginCellNbr - 1)
'iterate through each comment (basically a for-each loop)
Set curCmt = wrdDoc.Comments(i - beginCellNbr + 1)
'to retrieve text of the comment
With excelApp.ActiveWorkbook.Worksheets(3)
.Cells(i, 1).Value = curDocVersionString
.Cells(i, 2).Value = curCmt.Scope.Information(wdActiveEndPageNumber)
With .Cells(i, 3)
.Value = curCmt.Range.Text
.WrapText = True
End With
.Cells(i, 4).Value = curCmt.Author
End With
Next i
excelApp.Visible = True
End Sub
---- end of: code ----
danke für eure Hilfe
Ich würde gerne eine GUI zu meinem Code schreiben, habe jedoch noch nie mehr gemacht als Macros zu schreiben.
Wie implementiere ich jetzt eine GUI wo ich die Zeile und die Version eingeben kann (jeweils eigenes Eingabefeld) und sobald ich "GO" Drücke das ganze korrekt übernommen in eine Excel Tabelle schreibe.
der Code ist foglendermassen:
---- following: code ----
Sub insertWordCommentsInExcel()
'
' insertWordCommentsInExcel
' Macro created 09.09.2010 by --
' Last update: 22.12.2010 by --
'
' Current functionality: Take comments, author, page number and predefined version-string
' and write it into currently open Excel-file, beginning with prespecified line number
'
Dim wrdDoc As Word.Document
Dim i, beginCellNbr As Integer
Dim curCmt As Word.Comment
Dim excelApp As Excel.Application
Set excelApp = GetObject(, "Excel.Application")
excelApp.Visible = False
'excelApp.Workbooks.Add
'the following variables need to be defined by the user
beginCellNbr = 7
curDocVersionString = "V1.0"
Set wrdDoc = Word.ActiveDocument
'Word.Documents.Open ("P:\blubb.doc")
For i = beginCellNbr To (wrdDoc.Comments.Count + beginCellNbr - 1)
'iterate through each comment (basically a for-each loop)
Set curCmt = wrdDoc.Comments(i - beginCellNbr + 1)
'to retrieve text of the comment
With excelApp.ActiveWorkbook.Worksheets(3)
.Cells(i, 1).Value = curDocVersionString
.Cells(i, 2).Value = curCmt.Scope.Information(wdActiveEndPageNumber)
With .Cells(i, 3)
.Value = curCmt.Range.Text
.WrapText = True
End With
.Cells(i, 4).Value = curCmt.Author
End With
Next i
excelApp.Visible = True
End Sub
---- end of: code ----
danke für eure Hilfe