Hi, can anyone help please . . I thought it would be quite straightforward .. I want to write the code to open an excel spreadsheet from with Access. I can see how to do it with the RunApp Action in a macro, but not in code. Thanks!
Hi, can anyone help please . . I thought it would be quite straightforward .. I want to write the code to open an excel spreadsheet from with Access. I can see how to do it with the RunApp Action in a macro, but not in code. Thanks!
I asssume you mean the Excel spreadsheet already exists and you want to open it, Edit it and re-save it ? If Yes, use something like this Function Open_Excel_File() On Error GoTo Excel_Error Dim xlApp As Excel.Application Dim xlWS As Excel.Worksheet Set xlApp = New Excel.Application If xlApp.FindFile = True Then Set xlWS = xlApp.Worksheets(1) ' your code here to do stuff on the worksheet xlWS.SaveAs xlApp.ActiveWorkbook.FullName xlApp.Quit Set xlWS = Nothing End If Set xlApp = Nothing Exit Function Excel_Error: MsgBox Err.Description xlApp.Quit Set xlWS = Nothing Set xlApp = Nothing End Function
Application.FollowHyperlink "C:\FolderName\FileName.xls"
1.Opening OLE Object Sync Issue within VBA Code
I have a Table with OLE object in a field of the table. I use a form with the table as its RecordSource. When I Activate the OLE object in the form, the first time, the VBA code doesn't advance until the OLE object is open (Visio in my case). When the program loops, the second time, the VBA code doesn't stop for the OLE to be open. This is my code: Do Until rs.EOF Forms![GenPPT]![OLEFile].Action = acOLEActivate Set AppVisio = GetObject(, "visio.Application") Set DocObj = AppVisio.ActiveDocument More VBA Code Here Stop More VBA Code Here Stop AppVisio.Quit Set AppVisio = Nothing rs.MoveNext Loop The problem is as follow: 1) When the VBA Code first Activate the OLE in my form, it waits until the OLE (Visio) is open before moving on in the VBA Code. 2) After the first time, when it loops back, the VBA code advance to the first "Stop" while the OLE is activating in from the Form. 3) I see this issue with Acc2000, 2003, and 2007. I am using XP sp2 OS. Can someone tell me how I can sync them up or is there something I am doing wrong??? Thanks You, Gary
2.How to code VBA to open "Open File Dialog Box" in MS ACCESS 2000
Hi, My client is still running MS ACCESS 2000, and no plan to move forward to 2003 yet. Is there a similar code to "With Application.FileDialog(msoFileDialogFilePicker)" in MS ACCESS 2000 ? Thanks Jean
3.Opening an Access db within vba
Hi, Can anyone tell me the best way of opening an Access db from within the vba code of another Access db? The db I want to open is protected by user-level security with a .mdw file. Basically I need to circumvent the usual Logon Name / Password process when opening a workgroup-protected .mdb and replace it with a single form, non-protected Access file which opens the new db with correct user name and password parameters. At the moment I am doing this by executing a Shell command within the vba, but I wonder if there is a better way to do this. If there isn't, can anyone tell me if there is a way of knowing if the Shell command executed successfully? Many thanks, Jim
4.Compressing an exported file within VBA Code
I am using MS Access 97 on an XP machine and was wondering how I can call the built in XP compression (zip) application from within VBA code? Due to space limitations I export a large chunk of data everyday to a comma delimited text file and would like to automatically compress the exported file to save disk space. Thanks
5.Simple VBA code to open other access database
I am trying to open another access database from a form, what is the simplest way to do that.
6. opening excel sheet in access VBA code
Users browsing this forum: No registered users and 31 guest