????? ??????? ???? ???? ???????? ?????? ????? Office ?? Visual Basic

?????? ????????? ?????? ?????????
???? ???????: 259971 - ??? ???????? ???? ????? ????? ??? ???????.
????? ???? | ?? ????

??????

????? ??? ????? ????? Office ?? Visual Basic (VB) ? ?? ??? ????? Office ??? ???? ????. ???? ?????? ???? ??? ???? ???? ?? ????????? (?? ???? ?????) ??? ????? VB ??? ???? ?????? ?? ??? ??? ??????? Visual Basic. ??? ?? ??? ??? ???? ?????? ??? ?????? ????? Visual Basic.

?????? ??? ??????? ????? ??????? ???? ?????? ???????? Office ????? ?????? ?????? ????? ???????. ??? ???? ???? ???? ????? ??? ????? ?????? ????? ???????? ??????? ?????? ???? ???? ???? ???? ???????? ??????? ??????? ? ???????? ???? ?? ????? ?? ?????? ????.

??????? ????

?? ??? ??????? ?? ????? ??? ????? Office ????? ???? ?? ????? ?? ???? ?? ???????? ?? ??????? Office. ?? ??? ??????? ??? ????? Office ???? ???? ???? ? ???? ??????? ????? ?? ?? ????????? ??? ???? ??????? ?????? ?? ???? ??????. ??? ???? ?? ?? ???? ???? ?????? ???? ???? ????????? ????? ???? ??????? ???? ??????.

??????? Office ??? ?????? ?? ??? ????? ??? ???????. ????? ????? ?????? Office ?? ????? ???? ???? ???????? ?????? ????? Office. ?? ?????? ?????? ?? ???????, ????? ????? ?? ?????? ?????? ???? ? ????? ????????? ???????? ?????? ?? ????? ??? ???????? ?????? ???? ????? ?????.

?? ???????? ??????? ??? ??????? ?????? ????? ?????? ?????? ????? ????? ?????? Office ???????:
  • ????? ?? ??? ??????? ?? ??????? ???? ??????? (???? ???? ????? ?? ???? ??????) ????? ?????? ???????? ????? ????? ????. ?? ??? ???????? ?????? ???? ???????? ??? ????? ?? ????? ????? ???? ???? ????. ??? ???? ??????? ??? ??? ?????? ????? ??? ???? ???? Excel "?" ??? ?????? ???? ???? ???? ? ???? Excel ???? ???? ???? ???????? ?????? ???? ?????? ??? ?? ???? ??????? ???? ?????? ??? ??????? ????? ???. ????? ???? ?????? ????? ???? ??????? ???? ?????? ??? ??????? ???????. ???????? ??? ??????? ??????? ????? ?????? ????? ? ?????? ????? ?????? ????? SaveChanges ????? ???? ???? ???? ???????? ???? ?????????. ?????? ??? ??????? ?????? ??? ????? ????? ?? ?? ??????? ????? ??????? ?? ??????? ???? ??? ??????? ???? ??? ??? ??????? ?????? ?????? ?? "????? ??????? ?? Microsoft:
    222101????? ????? ????? ???? ???? Office ??????????
  • ?????? ???? ???? ?? ????? Office ?????? ?? ??? ?? ???? ???? ????? ???? ??????? ???? ??????. ??? ???? ??????? ????? ?????? Excel ???????AskToUpdateLinks ?????? AlertBeforeOverwriting.
  • ????? ??????? Application.DisplayAlerts (Excel? Project? Word) ?? ?????? Application.DoCmd.SetWarnings False (?????? ???) ?????? ????? ??? ????? ???????. ???? ?? ???? ???? ???? ??? ???? ?????? ?????? ???? ??????? ??? ???????.
  • ????? ??????? Application.FeatureInstall (Office 2000 ?????????? ??????) ??????? ???? ?????? ?????? "??? ?????? ??? ????..." ??? ?????? ??? ???? ???? ?? ?? ???? ?????? ??? ???? ????????.
  • ?????? ??????? ??????? ??? ??? ???? ????? ??? ??? ??????? ???? ?? ???? ??, ??? ??? ????? Application.ActivePrinter ??? ????? ?? ?????? ????? ??????? ??? ???? ????????.
  • ?????? ??????? ????? ?? ?????? ???????? ?? ???? ???? ?????? ??????. ??? ???? ??????? ????? ?? ??????? ??????? SaveAs ?? ????? Office ???? ???. ??? ??? ????? ??????? ??????? ?? ???? ???? ???? ???? ????? ??????? ????? ???????. ?? ???? ????? ????????? ???????? ?????? ?? ???? ????? ??? ??????? ??????? SaveAs ????? ???? ?????? ???? ???? ??????. ??? ???? ??????? ??? ??? ????? ??????? ??????? ???? ???????? ??????? ????? ??? ??????? ??????? SaveAs.
?????? ??? ?? ???? ??????? ??? ???????? ??? ?????? ????? ??????? ????? ?? ????? ?????? ?????? ???? ?? ?? ???? ??? faced ?? ???? ??? ?? ???? ???? ???? ???? ?? ?????? ?????? ??? ?? ???? ???? ????? Office. ?? ??? ?? ???? ?? ??????? ??? ?????? ???? ???? ???? ????? ?????? ????? ?????? ????? ????????. ???? ????? ???????? ?????? ????? ??? ???? ????? ?? ???? ??????? Visual Basic.

?????

???? ??????? ?? ??? ?????? ??????? ?? Microsoft Word ????? ?????. ????????? ?????? ??????? ????? PrintOut ????? Word ???????. ??? ?? ????? ??????? ?????????? ???????? ??? ?????? FILE ??????? PrintOut ???? ???? ???? ?????? ???????? ?????? ??? ???. ?????? ?? ??? ??? ????? PrintOut ???? ??? ???? ???? ?????? ??? ?????? ?????? ??????? Visual Basic ???? ???? ???? ????? ?? ??? ?????? ??? ??????? ????? PrintOut. ??? ??????? PrintOut ? ???? ??? ????? ?????? ??? ????? ?? ??? ?????. ??? ?????? PrintOut?????? ????. ????? ??? ????? ??????? PrintOut ??? ??? ???? ?? ??? ????? ????? Timer ?? ????? ?? ????? ???. ????? ??????? ?????? ????? ??????? ?????? ???? ????? PrintOut. ??? ???? ?? ???? ???? ????? Timer ??? ?????? ?????? ?????? ??? ????? ??? ?? ??? ????? ??????? PrintOut ?? ???? ??????? ???? ???? ?????? ????? ?? ??? ????????. ??? ????? ????? Timer ?????? ??????? ???? ??? Word ??????? SendKeys ?????? ???? ??????.

?????? ?????? ????? ???????? ??? ??????? ?????? ????? PrintOut ?????? ???? ?? ???? ???? ???? ????? ??? ??????? ??? ????? ????? ??? ???? FILE. ?????? ?????? ?? ????? ??????? ??? PrintOut ????????? OutputfileName ? PrintToFile ? ???? ????? ????? ????? ???? ?????? ???.

???????? ??? ???? ??? ??????? ??? ??????? "????" ? ???? ???? ????? ??? ???????? ???? ???? ???? ?? ??? ?? ??? ????? ? ???????? ??? ????? ????? ???????? ????? ??? ???? ??????.

????? ??? ????? ???????? ???????? Visual Basic ?????:
  1. EXE ActiveX ???? ??? ???? ????????? ????? ?? ?????. ??? ????? ???????? EXE ActiveX ????? ????? ?????? ?? ??? ???? ?? ????? ?????? ? ?????? ???? ????? ?????. ???? ??? ?? ?????? ??? ???? ???? ??? ????? ????? ?????? ??????? ???????? ?????? ?????.
  2. EXE ???????? ???? ?????? ??????? ???????? ??? Word ??? ???????? ????? PrintOut ?????? ?????. ??????? EXE ActiveX ????? ?? ????? ??? ??????? ??????? PrintOut.
????? ????? ActiveX EXE
  1. ?? ?????? Visual Basic ?? ????? ????? ActiveX EXE. ??? ????? Class1 ???? ???????.
  2. ?? ??????? ??????? ???? ??? ????? ?? ?? ?????? ??? ??????? ??? MyTimer.
  3. ??? ???? ???????? ???????? ??????? ???? ?????? ??????? Class1:
    Option Explicit
    
    Public Event Timer()
    Private oForm1 As Form1
    
    Private Sub Class_Initialize()
        Set oForm1 = New Form1
        oForm1.Timer1.Enabled = False
    End Sub
    
    Private Sub Class_Terminate()
        Me.Enabled = False
        Unload oForm1
        Set oForm1 = Nothing
    End Sub
    
    Public Property Get Enabled() As Boolean
        Enabled = oForm1.Timer1.Enabled
    End Property
    
    Public Property Let Enabled(ByVal vNewValue As Boolean)
        oForm1.Timer1.Enabled = vNewValue
        If vNewValue = True Then
            Set oForm1.oClass1 = Me
        Else
            Set oForm1.oClass1 = Nothing
        End If
    End Property
    
    Public Property Get Interval() As Integer
        Interval = oForm1.Timer1.Interval
    End Property
    
    Public Property Let Interval(ByVal vNewValue As Integer)
        oForm1.Timer1.Interval = vNewValue
    End Property
    
    Friend Sub TimerEvent()
        RaiseEvent Timer
    End Sub
    					
  4. ?? ??????? ??????? ?????? ????? ????? ??? ????? ????? ???? ??? ???????.
  5. ????? ???? ???? ???? ??? ???????.
  6. ??? ???? ???????? ???????? ??????? ?? ?????? ??????? ????????? ???????? ?? Form1:
    Option Explicit
    
    Public oClass1 As Class1
    
    Private Sub Timer1_Timer()
        oClass1.TimerEvent
    End Sub
    					
  7. ??? ??? ??????? ?? ???? ???? ???? ???? ??????.
  8. ?? ??????? ???? ???? ??? MyTimer.Exe ????? ?????? ???????.
????? ???? ???????
  1. ????? ????? EXE ????? ???? ?? Visual Basic. ??? ????? Form1 ???? ???????.
  2. ????? ???? ???? CommandButton ??? ???????.
  3. ?? ??????? ??????? ??? ?????. ????? ????? ??? ????? ?????? Microsoft Word 8.0 (?? 9.0, ?? 10.0) ???? MyTimer.
  4. ??? ???? ???????? ???????? ??????? ??? ?????? ??????? ???????:
    Option Explicit
    
    Private oWord As Word.Application
    Private strWordCaption As String
    Private WithEvents oMyTimer As MyTimer.Class1
    
    Private Sub Form_Load()
        'Create MyTimer object, and then disable it by default:
        Set oMyTimer = New MyTimer.Class1
        oMyTimer.Enabled = False
    End Sub
    
    Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
        'Terminate MyTimer object when the form is closed:
        oMyTimer.Enabled = False
        Set oMyTimer = Nothing
    End Sub
    
    Private Sub Command1_Click()
        On Error GoTo ErrorHandler
        
        'Create a new Word instance and put text in the new document:
        Set oWord = CreateObject("Word.Application")
        oWord.Visible = True
        oWord.Documents.Add
        oWord.Selection.TypeText "Hello World!"
        
        'Prepare Timer to "watch out" for a delay in calling PrintOut:
        strWordCaption = GetWordCaption 'for use with AppActivate
        oMyTimer.Interval = 5000 'allow 5 second wait time
        oMyTimer.Enabled = True
            
        'Call the PrintOut method, which may prompt the user to select
        'an output file name if the default printer is set to FILE:
        oWord.PrintOut Background:=False
    
    Done:
        On Error Resume Next
        'Turn off Timer:
        oMyTimer.Enabled = False
        
        'Close document and quit the Word instance:
        oWord.ActiveDocument.Close SaveChanges:=False
        oWord.Quit
        Set oWord = Nothing
        Exit Sub
    ErrorHandler:
        Resume Done
    End Sub
    
    Private Sub oMyTimer_Timer()
    'If this event occurs, there was a delay in calling PrintOut.
    'You can assume that the delay is caused by a dialog box prompting
    'for an output file name because the user has the printer
    'configured to print to FILE. SendKeys is used to provide the
    'output file name and dismiss the dialog box.
        Dim strKeys As String
        
        On Error Resume Next
        
        'Make sure that Word has the focus before using SendKeys to it:
    
        AppActivate strWordCaption 'Set focus to Word.
        
        'Send keystrokes to enter the output file name:
        If Right$(App.Path, 1) = "\" Then
            strKeys = App.Path & "MyOutput.prn"
        Else
            strKeys = App.Path & "\MyOutput.prn"
        End If
        Kill strKeys 'make sure file does not already exist
        strKeys = strKeys & "~" '~ represents the OK button to dismiss dialog
        SendKeys strKeys, True
           
        'Disable MyTimer:
        oMyTimer.Enabled = False
    End Sub
    
    Private Function GetWordCaption() As String
    'Returns the Word Caption. For use with the AppActivate statement
        Dim s As String
        On Error Resume Next
        If Left$(oWord.Version, 1) = "8" Then
            'Word 97 logic:
            s = oWord.Caption
        Else
            'Word 2000 or 2002 logic:
            Err.Clear
            s = oWord.ActiveWindow.Caption
            If Err.Number = 0 Then 'no error
                s = s & " - " & oWord.Caption
            Else
                s = oWord.Caption
            End If
        End If
        GetWordCaption = s
    End Function
    					
  5. ??? ??? ??????? ?? ???? ???? ???? ???? ????.
  6. ???? ??????? F5 ?????? ???????. ???? "Form1".
  7. ???? ??? Command1 ?? ???????. ??? ???? Word ???? ????? ???? ??? ? ?? ????? ??? ??????? ?????? ??????? ??????? PrintOut. ?? ??? ??? ???? ???? ??? ?? ????? ??????? ??????? ??? ?????.
  8. ?? "???? ???? Windows?" ????? ??????? ?????????? ??? ??? ?????? ??? ?????? FILE.
  9. ???? ??? Command1 ??? ???? ????? ???? ???? ???? ?? Word. ?? ?????? ???? ?????? ?? ???????? ???? ??? ???? ?? ??? ??? ???? ?????? ???? ????? ??? ???? ????? Timer. ??? ????? ??? ????? ??????? MyOutput.prn ?? ?????? ?????? ????.
???? Microsoft ??????? ???????? ??? ??? ?? ???? ??????? ?? ?? ????? ? ? ?? ????? ??? ?????? ???????? ??????? ?/?? ???????? ???? ????. ????? ??? ??????? ??? ????? ??? ??? ??????? ???? ?? ????? ???????? ????????? ?????? ????????? ????????. ???? ?? ????? ??????? ????? Microsoft ??? ????? ????? ???? ???? ?? ?????? ?????? ??? ??????? ?????? ????? ?????? ?? ????? ??????? ?????? ????????? ???????.
??? ??? ??? ?? ???? ???? ???? ?????? ?? ???? ???????? ?? ????? ??? ??????? ????? Microsoft ?? ????? ???????. ????? ?? ?????????? ?? ?????? ????? ??? Microsoft ???:

Microsoft ????????? Partners ? https://partner.microsoft.com/global/30000104

????? Microsoft ??????? ???? ???? ??????? - http://support.microsoft.com/gp/advisoryservice

?????? ??? ???? ?? ????????? ??? ?????? ????? ???????? ???? ????? ??????? ????? Microsoft ?? ?????? ???? Microsoft ?????? ??? ?????: http://support.microsoft.com/default.aspx?scid=fh;EN-US;CNTACTMS

?????

?????? ??? ??????? ??????? ???? ??? ????? ???????? ??????? ?????? ?? "????? ??????? ?? Microsoft:
257757INFO: ???????? ??????? ???????? ?? ???? ?????? ?? Office
226118OFF2000: ????? ??????? Visual Basic ?????????
253235FILE: Offautmn.exe ?????? ??? ??????? Office 97 "?" ??????? ???????? 2000 ??? ???? ????? ????????? ????????
?????? ??? ??????? ?????? ??? ????? Office ?????? ???? ??? ????? Office ?? ???? Microsoft ?????? ??? ?????:
http://support.microsoft.com/ofd

???????

???? ???????: 259971 - ????? ??? ??????: 27/?? ?????/1427 - ??????: 6.7
????? ???
  • Microsoft Office Access 2003
  • Microsoft Access 2002 Standard Edition
  • Microsoft Access 2000 Standard Edition
  • Microsoft Access 97 Standard Edition
  • Microsoft Office Excel 2003
  • Microsoft Excel 2002 Standard Edition
  • Microsoft Excel 2000 Standard Edition
  • Microsoft Excel 97 Standard Edition
  • Microsoft Office PowerPoint 2003
  • Microsoft PowerPoint 2002 Standard Edition
  • Microsoft PowerPoint 2000 Standard Edition
  • Microsoft PowerPoint 97 Standard Edition
  • Microsoft Office Word 2003
  • Microsoft Word 2002 Standard Edition
  • Microsoft Word 2000 Standard Edition
  • Microsoft Word 97 Standard Edition
  • Microsoft Visual Basic 5.0 Professional Edition
  • Microsoft Visual Basic 6.0 Professional Edition
  • Microsoft Visual Basic 5.0 Enterprise Edition
  • Microsoft Visual Basic Enterprise Edition for Windows 6.0
????? ??????: 
kbmt kbautomation kbhowto kbprogramming KB259971 KbMtar
????? ????
???: ??? ????? ??? ?????? ???????? ?????? ????? ???? ????? ?????????? ????? ?? ????????? ?????? ????. ???? ???? ?????????? ???? ?? ???????? ???????? ?????? ????????? ????? ????????? ???????? ????? ???????? ?????? ?? ?????? ??? ?? ???????? ???????? ?? ????? ??????? ?????? ??? ??????? ?????? ??. ?????? ?? ???? ??? ??????? ???????? ????? ?? ???? ????? ?????? ??? ????? ??? ????? ??????? ?? ????? ?? ?????? ??? ??? ??????? ??????? ?? ????? ????? ????? ????? ?????. ?? ????? ???? ?????????? ??????? ??? ????? ?? ??????? ?? ????? ?????? ?? ??? ????? ?? ????? ??????? ?? ???????? ?? ??? ???????. ???? ???? ?????????? ???????? ??? ????? ?????? ??????? ??????
???? ??? ????? ??????? ?????? ??????????259971

????? ???????

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com