I have multiple projects in the same database that use the same dll code. Currently I have to define in the dll what the project names are and what the unc path is that each particular project needs to reference for it's excel file. The excel file contains notes that updated by an outside source. i have set up the notes to update automatically when the designers open the drawings that contain the notes that are in the referenced excel file. I would like for the code to not have me put in each of the projectnames and ref unc path and update the dll each time we get a new project. I would like it to use the current ini file that is already being used and open the associated projects refdata folder. in that folder i want to place a txt file that contains the unc path of the excel file that is to be referenced for the note update dll. is there a way to do this?

currently the in the code we define the current project in an IF statement.. like

IF ProjectName = XYZ then  
objExcel.Workbooks.Open ("pathofexcelfile")

what i want it to do instead is open the refdata folder of the current project, find a txt file lets call it "updatenotes.txt" (this txt file contains a unc path \\ushouwpcad\yadayada (file://ushouwpcad/yadayada)) i want it to copy that path and place it in the

objExcel.Workbooks.Open ("pathofexcelfilecopied from the txt file in the refdata folder of the active project")

that way i do not have to define all of the project names in the dll each time we get a new project and i do not have to put the unc path in the dll each time we get a new project. i can just edit the txt file in the ref data folder to reflect the location of the new excel file.

Recommended Answers

All 2 Replies

I know this is not 100% correct but maybe something like this.. (or am I way off?)

Dim strItemNoteUpdate As String
Dim strBackSlash As String
Dim intItempNotePath As Integer

strBackSlash = IIf (Right$(App.Path, 1) = "\", "", "\")
strItemNoteUpdate = App.Path & strBackSlash & "\refdata\updateitemnote.dat"
Open strItemNoteUpdate For Input As #intItempNotePath

Do While Not EOF(intItemNotePath)
objExcel.Workbooks.Open (intItemNotePath)

close #intItemNotePath

Your code looks fine, is it working for you?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.