Click here to Skip to main content
15,894,180 members
Home / Discussions / C#
   

C#

 
RantRe: Events in c# Pin
Spacix One22-Apr-08 3:45
Spacix One22-Apr-08 3:45 
GeneralRe: Events in c# Pin
CPallini22-Apr-08 5:45
mveCPallini22-Apr-08 5:45 
QuestionTyped datasets? Pin
RitchieRich22-Apr-08 3:01
RitchieRich22-Apr-08 3:01 
AnswerRe: Typed datasets? Pin
Not Active22-Apr-08 3:16
mentorNot Active22-Apr-08 3:16 
GeneralRe: Typed datasets? Pin
RitchieRich22-Apr-08 3:19
RitchieRich22-Apr-08 3:19 
GeneralRe: Typed datasets? Pin
Not Active22-Apr-08 3:32
mentorNot Active22-Apr-08 3:32 
GeneralRe: Typed datasets? Pin
RitchieRich22-Apr-08 3:51
RitchieRich22-Apr-08 3:51 
QuestionTransfering VBA code (Word 2003 macro) over to a C# application Pin
Nahual22-Apr-08 3:00
Nahual22-Apr-08 3:00 
<code>Public Sub MassReplace()
With Application.FileSearch
.LookIn = "C:\AWCzx10" ' where to search
.SearchSubFolders = True ' search the subfolders
.FileName = "*.TXT" ' file pattern to match

'NOTE: I got this code from a friend, I do not know who originally wrote it so all credits go to the owner.
' I need to be able to batch edit the documents TXT files
If .Execute() > 0 Then
' to display how many files this macro will access,
' uncomment the next line of code
' MsgBox "Found " & .FoundFiles.Count & " file(s)."

' for each file you find, run this loop
For i = 1 To .FoundFiles.Count
' open the file based on its index position
Documents.Open FileName:=.FoundFiles(i)

'there are a bout 20 different items being swapped or removed here
'so I just listed a couple to keep it simple
'***************************************HERE WE GO *******
'ActiveWindow.ActivePane.View.Zoom.Percentage = 200
' Selection.Find.ClearFormatting
' Selection.Find.Replacement.ClearFormatting
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "Mz01"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "M2z07"
.Replacement.Text = "M5zz1 trr455 sd65y"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
'the list goes on and on

'************************************END OF SWAPPING FOR ALL FILES****
' save and close the current document
ActiveDocument.Close wdSaveChanges
Next i
Else
' if the system cannot find any files
' with the .doc extension
MsgBox "No files found."
End If
End With
End Sub

</code>
I need to load the code on a simple form with a button that executes the code, plain and simple with no input from the user.
I loaded the reference to the XPias, but I can not successfully transfer the code over.

Thank You in advance!
GeneralRe: Transfering VBA code (Word 2003 macro) over to a C# application Pin
Spacix One22-Apr-08 3:42
Spacix One22-Apr-08 3:42 
GeneralRe: Transfering VBA code (Word 2003 macro) over to a C# application Pin
Nahual22-Apr-08 5:01
Nahual22-Apr-08 5:01 
GeneralRe: Transfering VBA code (Word 2003 macro) over to a C# application Pin
Spacix One22-Apr-08 7:44
Spacix One22-Apr-08 7:44 
GeneralRe: Transfering VBA code (Word 2003 macro) over to a C# application Pin
Nahual23-Apr-08 3:54
Nahual23-Apr-08 3:54 
GeneralRe: Transfering VBA code (Word 2003 macro) over to a C# application Pin
Nahual24-Apr-08 14:12
Nahual24-Apr-08 14:12 
Generalwordpad Pin
negar77722-Apr-08 2:59
negar77722-Apr-08 2:59 
GeneralRe: wordpad Pin
Pete O'Hanlon22-Apr-08 3:03
mvePete O'Hanlon22-Apr-08 3:03 
GeneralRe: wordpad Pin
phannon8622-Apr-08 3:11
professionalphannon8622-Apr-08 3:11 
GeneralRe: wordpad Pin
Spacix One22-Apr-08 3:14
Spacix One22-Apr-08 3:14 
GeneralRe: wordpad Pin
Reelix22-Apr-08 3:24
Reelix22-Apr-08 3:24 
GeneralRe: wordpad Pin
Spacix One22-Apr-08 3:33
Spacix One22-Apr-08 3:33 
GeneralRe: wordpad Pin
negar77722-Apr-08 4:04
negar77722-Apr-08 4:04 
GeneralRe: wordpad Pin
Reelix22-Apr-08 4:10
Reelix22-Apr-08 4:10 
GeneralRe: wordpad Pin
Reelix22-Apr-08 3:22
Reelix22-Apr-08 3:22 
GeneralFileSystemWatcher Pin
stancrm22-Apr-08 2:50
stancrm22-Apr-08 2:50 
GeneralRe: FileSystemWatcher Pin
Spacix One22-Apr-08 2:58
Spacix One22-Apr-08 2:58 
GeneralRe: FileSystemWatcher Pin
Not Active22-Apr-08 3:12
mentorNot Active22-Apr-08 3:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.