L
lightspeed
Office 2003:
I've seen similar postings a couple times without a good solution. I
have an excel macro that flags the active row by puting the value "1"
in column 101. It then launches a filtered (DDE) word mailmerge
document that omits all data except the row with "1" in column 101.
This allows me to create a new word document based on the data of the
selected row.
code:
Sub MakeReferral()
' MakeReferral Macro
'save row number in holdrow variable
holdrow = Selection.Row
'put "1" in column 101 of active row
Cells(holdrow, 101).Value = 1
'Launch Word and make it visible
Set WordObj = CreateObject("Word.Application")
WordObj.Documents.Open ("P:\aftercare\Aftercare Referral Filtered.doc")
WordObj.Visible = True
Set WordObj = Nothing
'Clean up
Cells(holdrow, 101).Value = ""
End Sub
Here's the problem: It hourglasses me for a good 30 seconds, and then
prompts me "list.xls is locked for editing", and I have to open a
duplicate read-only version of the spreadsheet. It merges the one
filtered row, and then I close the duplicate spreadsheet.
While this does what it's supposed to, it wastes more time than it
saves. If I repeat the process manually, It works instantaneously
without any prompts or duplicate databases. I've seen a solution that
closes the .xls document in the process, but I don't want to do that.
Any ideas?
--jabberwocky
I've seen similar postings a couple times without a good solution. I
have an excel macro that flags the active row by puting the value "1"
in column 101. It then launches a filtered (DDE) word mailmerge
document that omits all data except the row with "1" in column 101.
This allows me to create a new word document based on the data of the
selected row.
code:
Sub MakeReferral()
' MakeReferral Macro
'save row number in holdrow variable
holdrow = Selection.Row
'put "1" in column 101 of active row
Cells(holdrow, 101).Value = 1
'Launch Word and make it visible
Set WordObj = CreateObject("Word.Application")
WordObj.Documents.Open ("P:\aftercare\Aftercare Referral Filtered.doc")
WordObj.Visible = True
Set WordObj = Nothing
'Clean up
Cells(holdrow, 101).Value = ""
End Sub
Here's the problem: It hourglasses me for a good 30 seconds, and then
prompts me "list.xls is locked for editing", and I have to open a
duplicate read-only version of the spreadsheet. It merges the one
filtered row, and then I close the duplicate spreadsheet.
While this does what it's supposed to, it wastes more time than it
saves. If I repeat the process manually, It works instantaneously
without any prompts or duplicate databases. I've seen a solution that
closes the .xls document in the process, but I don't want to do that.
Any ideas?
--jabberwocky