Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 01-30-2017, 09:54 AM
aramaglia aramaglia is offline String will not fully concatenate Windows 7 64bit String will not fully concatenate Office 2016
Novice
String will not fully concatenate
 
Join Date: Jan 2017
Posts: 8
aramaglia is on a distinguished road
Question String will not fully concatenate

Hello,

So I have a word document that when the user closes it out, I would like the document to save itself in its current folder as well as save as a PDF (which is already existing and should be overwritten) in a different folder. In order to reference the correct PDF when saving, I am using the text (just an 9-digit number) from a table cell in the word document and using that text as part of the folder path to the PDF file.

The problem is that when I am storing the 9-digit number as a string variable ("QN" below in the code), the variable that I am using for the file path (RefDocPath) to the PDF file will not store any text after the "QN" variable. I inserted a msgbox to see what was being stored and it shows a dot in the string after the "QN" variable. (See attached photo). I've never seen this before and I do not know what to do.



Code:
Private Sub Document_Close()

Dim RefDocPath As String
Dim QN As String
Dim Doc As Document

    Application.DisplayAlerts = False
    QN = ThisDocument.Tables(1).Cell(2, 2).Range.Text
    RefDocPath = "G:\Shared\Ref_Docs\Quality Alerts\X_X_" & QN & "_X_X_QualityAlerts.pdf"
    MsgBox RefDocPath
    
    ThisDocument.Save
    ThisDocument.SaveAs2 FileName:=(RefDocPath), AddtoRecentFiles:=False, FileFormat:=wdFormatPDF
    Application.DisplayAlerts = True
    
End Sub
Attached Images
File Type: png Capture.PNG (21.2 KB, 17 views)
Reply With Quote
 

Tags
concatenate, saveas, word to pdf

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to find all string within string. PRA007 Word VBA 18 02-12-2016 08:11 PM
String will not fully concatenate Format Painter must be used twice to work fully Jim_H Word 5 04-13-2015 04:41 PM
String will not fully concatenate Way to search for a string in text file, pull out everything until another string? omahadivision Excel Programming 12 11-23-2013 12:10 PM
String will not fully concatenate How to fully justify columns empressive Word 10 01-17-2012 09:17 PM
String will not fully concatenate Outlook 2007 Not Fully Closing LabanM Outlook 1 09-28-2010 02:27 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:18 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft