LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Automation Code Problem from Access to Excel

I have a problem changing the drive in my Excel application that I
create with code in Access. The Drive is changed in Access, not in
Excel. The code should check to see if "A" drive is ready, and if so,
start the File open dialog in drive "A". It works, but for the Access
application it is run from, not the new Excel Workbook. My pertinent
code is below. Any help will be appreciated.


Private Sub cmdRunBHmacro_Click()
Dim xlObject As Excel.Application


Set xlObject = New Excel.Application
xlObject.Visible = True

Dim fs
Set fs = CreateObject("Scripting.FilesystemObject")
If fs.Drives("A").IsReady = True Then
ChDrive "A"
End If

FileToOpen = xlObject _
.GetOpenFilename("All Files (*.*), *.*", , "Open BH Loop Data File")
If FileToOpen < False Then
myFileName = fs.GetFileName(FileToOpen)
End If

If FileToOpen = False Then
End
End If


xlObject.ScreenUpdating = True
xlObject.Workbooks.OpenText Filename:=FileToOpen, _
DataType:=xlDelimited, Tab:=True
Windows(1).WindowState = xlMaximized

End Sub

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Automation to Excel from Access Bob Barnes Excel Discussion (Misc queries) 1 February 11th 08 05:18 AM
Access Automation to Excel Bob Barnes[_3_] Excel Programming 0 January 15th 04 01:47 AM
Access automation from Excel AccessChallenged Excel Programming 2 December 31st 03 06:29 PM
Automation from .pdb to excel and then to access Kenny chan Excel Programming 1 December 13th 03 01:28 AM
Automation Excel & Access GarethG Excel Programming 6 October 3rd 03 09:14 AM


All times are GMT +1. The time now is 11:11 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"