MichaelS
06-14-2006, 08:47 AM
Can somebody help?
I want to open an existing database from another database by VBA.
I can successfully open a word document also an excel workbook by using the following code (Got from http://www.databasedev.co.uk/forms.html), however I have tried using the same format for opening a database and have failed miserably.
Code to open Word document
Sub OpenWordDoc(strDocName As String)
Dim objApp As Object
'Opens the document
Set objApp = CreateObject("Word.Application")
objApp.Visible = True
objApp.Documents.Open strDocName
End Sub
Code to open Excel document adapted from above code
Sub OpenExcelxls(strDocName As String)
Dim objApp As Object
'Opens the document
Set objApp = CreateObject("Excel.Application")
objApp.Visible = True
objApp.Workbooks.Open strDocName
End Sub
Thanks in anticipation
Mike
I want to open an existing database from another database by VBA.
I can successfully open a word document also an excel workbook by using the following code (Got from http://www.databasedev.co.uk/forms.html), however I have tried using the same format for opening a database and have failed miserably.
Code to open Word document
Sub OpenWordDoc(strDocName As String)
Dim objApp As Object
'Opens the document
Set objApp = CreateObject("Word.Application")
objApp.Visible = True
objApp.Documents.Open strDocName
End Sub
Code to open Excel document adapted from above code
Sub OpenExcelxls(strDocName As String)
Dim objApp As Object
'Opens the document
Set objApp = CreateObject("Excel.Application")
objApp.Visible = True
objApp.Workbooks.Open strDocName
End Sub
Thanks in anticipation
Mike