jagrenet
Board Regular
- Joined
- Feb 23, 2022
- Messages
- 81
- Office Version
- 365
- 2013
- 2011
- 2010
- Platform
- Windows
Hello Gurus,
I have searched the Forum for the answer but, did not find anything matching my particular issue. Using VBA from Excel, I am creating a Word.Application to open a Word doc, copy the Paragraphs and paste them into Excel. Everything was working perfectly in my sandbox(testbed), without any problems at all.
When I decided the code was correct and ready for production, I moved it to a new Module. This is when I began getting "User-defined type" errors. I have checked, double checked and triple checked that all of the reference library's are added/loaded/referenced.(see attached image) They must be because this code worked flawlessly before I moved it.
Here are my Declarations -
Dim Nf_Rows As Long
Dim Nf_Columns As Long
Dim wd As Word.Application
Dim doc As Word.Document
Dim wr As Word.Range
Set wd = Word.Application
wd.Visible = True
wd.DisplayAlerts = wdAlertsNone
Set doc = wd.Documents.Open(OpenFile, False)
Set wr = doc.Paragraphs(1).Range
wr.WholeStory
While Stepping through the code, these Variables are the only problem that the Debugger does not like. Again, it's strange to me how it can work flawlessly one moment and then "out-of-nowhere" just decides it doesn't like my User-defined Variables.
Thanks in advance,
Jeff
I have searched the Forum for the answer but, did not find anything matching my particular issue. Using VBA from Excel, I am creating a Word.Application to open a Word doc, copy the Paragraphs and paste them into Excel. Everything was working perfectly in my sandbox(testbed), without any problems at all.
When I decided the code was correct and ready for production, I moved it to a new Module. This is when I began getting "User-defined type" errors. I have checked, double checked and triple checked that all of the reference library's are added/loaded/referenced.(see attached image) They must be because this code worked flawlessly before I moved it.
Here are my Declarations -
Dim Nf_Rows As Long
Dim Nf_Columns As Long
Dim wd As Word.Application
Dim doc As Word.Document
Dim wr As Word.Range
Set wd = Word.Application
wd.Visible = True
wd.DisplayAlerts = wdAlertsNone
Set doc = wd.Documents.Open(OpenFile, False)
Set wr = doc.Paragraphs(1).Range
wr.WholeStory
While Stepping through the code, these Variables are the only problem that the Debugger does not like. Again, it's strange to me how it can work flawlessly one moment and then "out-of-nowhere" just decides it doesn't like my User-defined Variables.
Thanks in advance,
Jeff