Home > Software engineering >  Invalid procedure call or argument
Invalid procedure call or argument

Time:11-08

My small white, with vba to modify folder word file called word first line, the card to the Name WORD_name As WORD_title this sentence, what is prompt, any invalid procedure call or parameters, beg god to look at, what happened,,,

Option Explicit
Sub open folder file and rename the title name them one by one ()

Dim WORD_title As String, EXCEL_name As String, EXCEL_name2 As String, WORD_name As String, the Count As Integer 'definition of word class
Dim Wordapp As Word. Application
Dim WordD As Word. The Document 'definition of Word class
'Wordapp. ScreenUpdating=False' screen refresh
With the Application. The FileDialog (msoFileDialogFilePicker) 'Open the file dialog
. AllowMultiSelect=True
The Show
For the Count=1 To. SelectedItems. Count
WORD_name=Dir. (SelectedItems (Count))

The Set Wordapp=New Word. Application
Visible Wordapp. Visible=True '
The Set WordD=Wordapp. Documents. The Open (. SelectedItems (Count) 'Open the document
WORD_title=ActiveDocument. Paragraphs (1). The Range, the Text
WordD. Save
WordD. Close Close the document '
The Set WordD=Nothing
WORD_title=WORD_title & amp; Mid (WORD_name, Application. The Find (". ", WORD_name)) 'excessive, the name and extension of

'Wordapp. Quit out of Word object
the Name WORD_name As WORD_title
Next the Count

End With

End Sub

CodePudding user response:

WORD_title=ActiveDocument. Paragraphs (1). The Range, the Text

You see if WORD_title value "carriage returns" or "line" end?

CodePudding user response:

reference 1/f, a toast to invite the bright moon response:
WORD_title=ActiveDocument. Paragraphs (1) Range. The Text

You see if WORD_title value "carriage returns" or "line" end?
no newline, is I adjusted the font size large, there is no line breaks

CodePudding user response:

Ha ha, don't understand, don't fake it!

You're in your own world and play...

CodePudding user response:

reference 3/f a toast to invite the bright moon response:
ha ha, don't understand, don't fake it!

You're in your own world and play...
true not understand, you said that WORD_title followed by a newline character? But no

CodePudding user response:

Is not a newline character, but it has a carriage return!!!!!!!!!!!

CodePudding user response:

Other people call you "eat", "drink", do you only eat "rice" or only "wine", don't eat food???

CodePudding user response:

Some characters, not with the eyes to see, but with the "heart" to see...


There are some detail problems, people from the "big" to infer,
Is unlikely to be all inference can "uniform" with the fact,
When you cannot "sure", don't you can verify this?

CodePudding user response:

refer to fifth floor a toast to invite the bright moon response:
is not a newline character, but it has a carriage return!!!!!!!!!!!

have a carriage return? I see, thank you for your patience taught

CodePudding user response:

refer to 7th floor glass band response:
has some characters, not with the eyes to see, but with the "heart" to see...


There are some detail problems, people from the "big" to infer,
Is unlikely to be all inference can "uniform" with the fact,
When you cannot "sure", don't you can verify this?
finally found a great god said a carriage return , is it make this program in the past, thank you
  •  Tags:  
  • VBA
  • Related