Public Sub openExcel () 'set properties dialog box that is used to specify the EXCEL file CommonDialog1. Filter="Excel file *. XLS" CommonDialog1. Action=1 If CommonDialog1. FileName<> "" Then Expath=CommonDialog1. FileName 'open the dialog box to specify the EXCEL workbook Workbooks. Open FileName:=expath Oldbook. Close The Else End the If End Sub CodePudding user response:
Workbooks. Open FileName:=expath
Where is the code? Vb or vba?
If it is a vb, should add a excel object in front of, such as:
Dim mExcel as new excel. Application
Mexcel. Workbooks. Open filename:=expath
.
CodePudding user response:
Thank you for your answer, using VB, also added the excel object, now the problem comes again, mexcel. Workbooks. Open filename:=expath runtime, 48, error loading DLL errors, seek guidance
CodePudding user response:
reference 1st floor Topc008 response: Workbooks. Open FileName:=expath Where is the code? Vb or vba? If it is a vb, should add a excel object in front of, such as: Dim mExcel as new excel. Application Mexcel. Workbooks. Open filename:=expath . Thank you for your answer, using VB, also added the excel object, now the problem comes again, mexcel. Workbooks. Open filename:=expath runtime, 48, error loading DLL errors, seek guidance CodePudding user response:
Example: 2003 environment Option Explicit Private mExcel As Excel. Application Private Sub Command1_Click () The Set mExcel=New Excel. Application MExcel. Visible=True Dim S1 As String S1="d: \ 6. XLS" MExcel. Workbooks. Open FileName: S1= End Sub After execution can see open 6. XLS file, You the excel is loaded some add-on or add-ins and other external DLLS? Are you still on all code and error here, not too good guess... CodePudding user response:
reference 4 floor Topc008 response: example: 2003 environment Option Explicit Private mExcel As Excel. Application Private Sub Command1_Click () The Set mExcel=New Excel. Application MExcel. Visible=True Dim S1 As String S1="d: \ 6. XLS" MExcel. Workbooks. Open FileName: S1= End Sub After execution can see open 6. XLS file, You the excel is loaded some add-on or add-ins and other external DLLS? Are you still on all code and error here, not too good guess... reference 4 floor Topc008 response: example: 2003 environment Option Explicit Private mExcel As Excel. Application Private Sub Command1_Click () The Set mExcel=New Excel. Application MExcel. Visible=True Dim S1 As String S1="d: \ 6. XLS" MExcel. Workbooks. Open FileName: S1= End Sub After execution can see open 6. XLS file, You the excel is loaded some add-on or add-ins and other external DLLS? Are you still on all code and error here, not too good guess... 'in the global module general statement variables as EXCEL object 'declare variables as EXCEL application object Public oldxls As Excel. Application 'declare variables as EXCEL workbook object . Public oldbook As Excel Workbook 'declare variables as EXCEL worksheet object Public oldsheet As Excel. The Worksheet 'write connection EXCEL subroutine (called joinExcel) Private Sub CmdJoinExcel_Click () On the Error Resume Next The Set oldxls=GetObject (App) Path, "Excel. Application") If Err Then Err. Clear The Set oldxls=CreateObject (" excel. Application ") If Err Then The Exit Sub End the If End the If Oldxls. Visible=True The Set oldbook=oldxls. Workbooks. Add The Set oldsheet=oldbook. Worksheets (1) End Sub 'write to open the EXCEL file subroutine openExcel Private Sub CmdOpenExcel_Click () 'set properties dialog box that is used to specify the EXCEL file If Err Then Err. Clear End the If CommonDialog1. Filter="Excel file *. XLS" CommonDialog1. Action=1 If CommonDialog1. FileName & lt;> "" Then Expath=CommonDialog1. FileName 'open the dialog box to specify the EXCEL workbook Workbooks. Open FileName:=expath 'this error, 48 xp system, Windows 7 system running 429 error, guidance If Err Then The Exit Sub End the If Oldbook. Close The Else End the If End Sub A great god, o very urgent, guidance! CodePudding user response:
Workbooks. Open FileName:=expath 'this error, 48 xp system, Windows 7 system running 429 error, guidance Either oldxls. Workbooks. Open FileName:=expath Either oldbook. Open FileName:=expath You get a light Workbooks to calculate what? CodePudding user response:
Confused, -- -- -- -- -- -- -- -- -- -- -- -- -- - either oldbook. Open FileName:=expath This is a mistake, oldbook didn't use CodePudding user response:
refer to 7th floor Topc008 response: confused, -- -- -- -- -- -- -- -- -- -- -- -- -- - either oldbook. Open FileName:=expath This is a mistake, oldbook didn't use Hello, oldbook. Open FileName:=expath, it changed, and there is an error 91, object variable is not set, just learning vb, for advice CodePudding user response:
Quote: refer to 7th floor Topc008 response: Confused, -- -- -- -- -- -- -- -- -- -- -- -- -- - either oldbook. Open FileName:=expath This is a mistake, oldbook didn't use [/q Completion of the great god, because the project tomorrow, can you give a contact, solve the problem directly, and I in vb6.0 by use of version estimated version is not the same with you, the problem is different alsonullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull