Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #5  
Old 07-30-2021, 05:40 AM
Guessed's Avatar
Guessed Guessed is offline MS PUB: Create multiple JPGs with containing custom text and custom file names Windows 10 MS PUB: Create multiple JPGs with containing custom text and custom file names Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,176
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

Hmm, yes, I tested it on my machine and I got the same result as you even though the preview showed the right thing.

OK, try this instead. Get rid of the merge fields from the page and make sure the cursor is sitting in the text frame where you want the name to appear. (The text frame should be otherwise empty so use a different frame than the good wishes lines). Then try this version of the macro.
Code:
Sub TestExport()
  Dim sName As String, sPath As String, aRng As TextRange
  Set aRng = Selection.TextRange
  With ActiveDocument.MailMerge.DataSource
    .ActiveRecord = 1
    Do
      sName = .DataFields.Item("Name").Value
      aRng.Paragraphs(1).Text = sName
      sPath = .DataFields.Item("JpgFolderPath").Value & "\" & .DataFields.Item("JpgFileName").Value
      ActiveDocument.Pages(1).SaveAsPicture Filename:=sPath, pbResolution:=pbPictureResolutionWeb_96dpi
      If .ActiveRecord = .RecordCount Then Exit Do
      .ActiveRecord = .ActiveRecord + 1
    Loop
  End With
End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Need to create an office (word) add-in to create a custom ribbon bar with icons avogt Word VBA 1 05-18-2018 06:06 AM
Custom table in custom Word 2010 template Hans L Word Tables 5 04-17-2018 08:42 AM
Create Custom Month Cfwoodbury Outlook 0 02-11-2015 09:55 AM
MS PUB: Create multiple JPGs with containing custom text and custom file names custom dictionary of full names? srobbins Word 3 06-17-2012 03:22 AM
MS PUB: Create multiple JPGs with containing custom text and custom file names create footnotes from custom text mosrozen Word VBA 2 06-14-2012 06:59 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 08:39 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