Home > Net >  Vb.net syntax error prompt expression does not produce value, in different events, the message is co
Vb.net syntax error prompt expression does not produce value, in different events, the message is co

Time:10-09

Make in BtnOpenFile_Click. OpenWord (myfilename) tip expression does not produce value

But in the Button1_Click make. OpenWord (" C: \ Users \ XHKJ \ Documents \ a. d. ocx "), there is no wrong
Public Class Form1
Public Shared make As YueWord=New YueWord
Private Sub Button1_Click (sender As Object, As EventArgs e) Handles for. Click
Make. OpenWord (" C: \ Users \ XHKJ \ Documents \ a. d. ocx ")
End Sub

Private Sub BtnOpenFile_Click (sender As Object, As EventArgs e) Handles BtnOpenFile. Click
Dim Themno As String
Dim myfilename As String
Themno=CMBThemID. Text
Myfilename=Application. StartupPath + Themno + 'docx'
Make. OpenWord (myfilename)
End Sub

Public Class YueWord
Public Shared app As Word. Application=New Word. The Application
. Public Shared myWordDocument As Word Document
Public Shared myWordFont As Word. The Font
Public Shared myDocPro As DocPro

Public Sub OpenWord (filename As String) 'open a file
App. The Visible=False
MyWordDocument=app. The Documents. The Open (filename, Nothing, [ReadOnly] :=True)
End Sub

CodePudding user response:

Code to write the wrong
Myfilename=Application. StartupPath & amp; Themno & amp; 'docx'

CodePudding user response:

Whether myfilename front to add a Set? Long time no play VB
  • Related