Run Excel Module

J

Jeefgeorge

I have a few queries which are transfered to an existing spreadsheet. Within
the spreadsheet, I have written code to reformat depending on the data which
is transfered. Is there a way to run this module from Access directly after
my transferspreadsheet commands?

Access Code that outputs queries to desired spreadsheet:
Private Sub Yes_Click()
Dim CurrentUser As Object
Dim DesktopPath As String
Set CurrentUser = CreateObject("Wscript.Shell")
DesktopPath = CurrentUser.SpecialFolders("Desktop")
DoCmd.TransferSpreadsheet acExport, 8, "Proj Info Transpose",
DesktopPath & "\Project Book.xls", , "ProjInfo"
DoCmd.TransferSpreadsheet acExport, 8, "Engineer's Estimate",
DesktopPath & "\Project Book.xls", , "BidtabRaw"
SendKeys "^+f"
DoCmd.Close acForm, "CopyPopUp"
End Sub


Excel Code:
Sub Format_Estimate()
' Keyboard Shortcut: Ctrl+Shift+F
'Change formatting of header rows
Rows("1:1").Select
Selection.RowHeight = 0
Range("A2:C2").Select
Range("C2").Activate
Selection.Merge
Range("A3:C3").Select
Range("C3").Activate
Selection.Merge
Range("A4:C4").Select
Range("C4").Activate
Selection.Merge
Range("A5:C5").Select
Range("C5").Activate
Selection.Merge
Range("A6:J6").Select
Selection.Copy
Range("A2:J5").Select
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
'Change formatting of Unit Cost column
Range("G8:G257").Select
Selection.Copy
Range("F8").Select
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
'Clear the clipboard and select cell A1
Call ClearClipboard
Range("A1:A1").Select
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top